[Snippet] Which Profile is Watching (en) (new update)

Little Mods and Snips 1

[Snippet] Which Profile is Watching (en) (new update)

Postby Sekuro » 07 Feb 2012, 00:28

[Snippet] Which Profile is Watching (en) (new)

With this snippet you can see, which profile is watched

- Show username of watched profile with group colours and link to watched profile

Screen: follows

Demo: follows

Instruction

open

viewonline.php

find

Code: Select all
// Get user list     

before add

Code: Select all
        // Which Profile is Watching / 4seven / 2011
        function user_get_name($u_id)
        {
           global $db;
           $sql = 'SELECT username, user_colour
                 FROM '
 . USERS_TABLE . '
                 WHERE user_id = '
 . $db->sql_escape($u_id);
           $result = $result = $db->sql_query_limit($sql, 1);
           $row = $db->sql_fetchrow($result);
           $db->sql_freeresult($result);
       
           if
($row)
           {
              return ': ' . get_username_string('full', $u_id, $row['username'], $row['user_colour']);
           }
           else
           
{
              return '';
           }
        }
        // Which Profile is Watching / 4seven / 2011        

find

Code: Select all
            preg_match('#^([a-z0-9/_-]+)#i', $row['session_page'], $on_page);
            if (!sizeof($on_page))
            {
                $on_page[1] = '';
            

after add

Code: Select all
        // Which Profile is Watching / 4seven / 2011    
        $on_apps    = explode("?",$row['session_page']); 
        $on_apps    
= (!empty($on_apps[1])) ? $on_apps[1] : '';
        $on_apps_u  = ($on_apps && strpos($on_apps, 'u=')) ? user_get_name(str_replace('mode=viewprofile&u=', '', $on_apps)) : '';    
        
// Which Profile is Watching / 4seven / 2011          

find

Code: Select all
            'FORUM_LOCATION'    => $location,

replace with

Code: Select all
            'FORUM_LOCATION'    => $location . $on_apps_u, // Which Profile is Watching / 4seven / 2011          


Clear all Board- and Browsercaches
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Re: [Snippet] Which Profile is Watching (en) (new update)

Postby Sekuro » 29 Sep 2012, 18:39

If you want the function for admins only

change this part

Code: Select all
        // Which Profile is Watching / 4seven / 2011    
        $on_apps    = explode("?",$row['session_page']); 
        $on_apps    
= (!empty($on_apps[1])) ? $on_apps[1] : '';
        $on_apps_u  = ($on_apps && strpos($on_apps, 'u=')) ? user_get_name(str_replace('mode=viewprofile&u=', '', $on_apps)) : '';    
        
// Which Profile is Watching / 4seven / 2011              

to

Code: Select all
        // Which Profile is Watching / 4seven / 2011   
        if ($auth->acl_get('a_')){
        $on_apps    = explode("?",$row['session_page']); 
        $on_apps    
= (!empty($on_apps[1])) ? $on_apps[1] : '';
        $on_apps_u  = ($on_apps && strpos($on_apps, 'u=')) ? user_get_name(str_replace('mode=viewprofile&u=', '', $on_apps)) : '';  
        
}
        else{
        $on_apps_u = '';
        }
        // Which Profile is Watching / 4seven / 2011              
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Re: [Snippet] Which Profile is Watching (en) (new update)

Postby Sekuro » 27 Nov 2012, 20:51

Code Update

Because of some reported sql errors, even if very rare,
there is an update, which should make this snippet complete error free.

Find (in instruction)

Code: Select all
        // Which Profile is Watching / 4seven / 2011    
        $on_apps    = explode("?",$row['session_page']); 
        $on_apps    
= (!empty($on_apps[1])) ? $on_apps[1] : '';
        $on_apps_u  = ($on_apps && strpos($on_apps, 'u=')) ? user_get_name(str_replace('mode=viewprofile&u=', '', $on_apps)) : '';    
        
// Which Profile is Watching / 4seven / 2011        

Replace with

Code: Select all
           // Which Profile is Watching / 4seven / 2011    
            $on_apps    = explode("?",$row['session_page']); 
            $on_apps    
= (!empty($on_apps[1])) ? $on_apps[1] : false;
            $on_apps_u  = (($on_page[1] == 'memberlist') && $on_apps && strpos($on_apps, 'u=')) ? user_get_name(str_replace('mode=viewprofile&u=', '', $on_apps)) : '';
            // Which Profile is Watching / 4seven / 2011     
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Re: [Snippet] Which Profile is Watching (en) (new update)

Postby Sekuro » 29 Nov 2012, 15:44

Code Update for Admin Only Version

Find (in instruction)

Code: Select all
        // Which Profile is Watching / 4seven / 2011   
        if ($auth->acl_get('a_')){
        $on_apps    = explode("?",$row['session_page']); 
        $on_apps    
= (!empty($on_apps[1])) ? $on_apps[1] : '';
        $on_apps_u  = ($on_apps && strpos($on_apps, 'u=')) ? user_get_name(str_replace('mode=viewprofile&u=', '', $on_apps)) : '';  
        
}
        else{
        $on_apps_u = '';
        }
        // Which Profile is Watching / 4seven / 2011     

Replace with

Code: Select all
        // Which Profile is Watching / 4seven / 2011   
        if ($auth->acl_get('a_')){
        
$on_apps    = explode("?",$row['session_page']); 
        $on_apps    
= (!empty($on_apps[1])) ? $on_apps[1] : false;
        
$on_apps_u  = (($on_page[1] == 'memberlist') && $on_apps && strpos($on_apps, 'u=')) ? user_get_name(str_replace('mode=viewprofile&u=', '', $on_apps)) : '';
        }
        else{
        $on_apps_u = '';
        }
        // Which Profile is Watching / 4seven / 2011     
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Return to Snip Cl@ss I

Who is online

Users browsing this forum: No registered users and 1 guest

cron