Area51 @ 4seven.de

Mod Base and Testarea
It is currently 23 Feb 2025, 14:54

All times are UTC + 1 hour




Post new topic TOPIC_LOCKED  [ 4 posts ] 
Author Message
PostPosted: 07 Feb 2012, 00:28 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
[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:
// Get user list     

before add

Code:
        // 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:
            preg_match('#^([a-z0-9/_-]+)#i', $row['session_page'], $on_page);
            if (!sizeof($on_page))
            {
                $on_page[1] = '';
            

after add

Code:
        // 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:
            'FORUM_LOCATION'    => $location,

replace with

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


Clear all Board- and Browsercaches

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
PostPosted: 29 Sep 2012, 18:39 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
If you want the function for admins only

change this part

Code:
        // 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:
        // 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


Top
 Profile  
 
PostPosted: 27 Nov 2012, 20:51 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
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:
        // 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:
           // 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


Top
 Profile  
 
PostPosted: 29 Nov 2012, 15:44 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Code Update for Admin Only Version

Find (in instruction)

Code:
        // 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:
        // 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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic TOPIC_LOCKED  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.011s | 22 Queries | GZIP : Off ]