Area51 @ 4seven.de

Mod Base and Testarea
It is currently 23 Feb 2025, 19:17

All times are UTC + 1 hour




Post new topic TOPIC_LOCKED  [ 2 posts ] 
Author Message
PostPosted: 15 Nov 2011, 03:43 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Online status on team page v1

demo: memberlist.php?mode=leaders
un: test / pw testuser

Attachment:
Area51 @ 4seven.de • The team_1321492940006.png
Area51 @ 4seven.de • The team_1321492940006.png [ 48.23 KiB | Viewed 1984 times ]

Instruction

download (rightclick)

    Image
    Image
copy

    on.png > images/on.png
    off.png > images/off.png
open

memberlist.php

find

Code:
$topic_id    = request_var('t', 0);


after add

Code:
// Online status on team page / 4seven / 2011
/**
* Prepare team online data
*/
function show_team_online($user_on)
{

global $config, $db;

if ($config['load_onlinetrack'])
{

$sqls = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline
         FROM '
 . SESSIONS_TABLE . "
         WHERE session_user_id = 
$user_on";
$results = $db->sql_query($sqls);
$rows = $db->sql_fetchrow($results);
$db->sql_freeresult($results);

$member_session_time = (isset($rows['session_time'])) ? $rows['session_time'] : 0;
$member_session_viewonline = (isset($rows['session_viewonline'])) ? $rows['session_viewonline'] :    0;

return $member_session_viewonline;

}

}
// Online status on team page / 4seven / 2011                    


find

Code:
            $template->assign_block_vars($which_row, array(
                'USER_ID'        => $row['user_id'],


after add

Code:
                // Online status on team page / 4seven / 2011
                'S_USER_ON'     => (show_team_online($row['user_id']) == 1) ? true : false,
                // Online status on team page / 4seven / 2011                    


open

styles/prosilver/template/memberlist_leaders.html

find

Code:
        <td><!-- IF admin.RANK_IMG -->


replace with

Code:
        <td><!-- IF admin.S_USER_ON --><img src="images/on.png" style="position:relative;top:4px;" alt="" /><!-- ELSE --><img src="images/off.png" style="position:relative;top:4px;" alt="" /><!-- ENDIF --><!-- IF admin.RANK_IMG -->


find

Code:
        <td><!-- IF mod.RANK_IMG -->


replace with
Code:

        
<td><!-- IF mod.S_USER_ON --><img src="images/on.png" style="position:relative;top:4px;" alt="" /><!-- ELSE --><img src="images/off.png" style="position:relative;top:4px;" alt="" /><!-- ENDIF --><!-- IF mod.RANK_IMG -->


Clear all Caches

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
PostPosted: 16 Nov 2011, 22:33 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Online status on team page v2

demo: memberlist.php?mode=leaders
un: test / pw testuser

Attachment:
Area51 @ 4seven.de • The team_1321492320376.png
Area51 @ 4seven.de • The team_1321492320376.png [ 47.53 KiB | Viewed 1986 times ]

update: Reduce sql requests from (count of leaders) to (1 sql request + 2 sql updates)

Instruction

download (rightclick)

    Image
    Image
copy

    on.png > images/on.png
    off.png > images/off.png
sql

Code:
ALTER TABLE phpbb_users ADD user_online tinyint(1) NOT NULL DEFAULT '0';

set phpbb_ to your prefix

open

memberlist.php

find

Code:
        $mod_id_ary = array_unique($mod_id_ary);


after add

Code:
// Online Status on Team Page / 4seven / 2011
$admin_mod_id_ary = array_merge($admin_id_ary, $global_mod_id_ary);
$admin_mod_id_ary = array_unique($admin_mod_id_ary);

$sql = 'UPDATE ' . USERS_TABLE . '
    SET user_online = 0
    WHERE '
 . $db->sql_in_set('user_id', $admin_mod_id_ary);
$db->sql_query($sql);

$sqls = 'SELECT session_user_id
         FROM  '
 . SESSIONS_TABLE . '
         WHERE '
 . $db->sql_in_set('session_user_id', $admin_mod_id_ary);
$results = $db->sql_query_limit($sqls, sizeof($admin_mod_id_ary));

while ($rows = $db->sql_fetchrow($results))
{

$rows_user_id[] = $rows['session_user_id'];

}

$db->sql_freeresult($results);

if(!empty(
$rows_user_id))
{

$rows_user_id = array_unique($rows_user_id);

$sql = 'UPDATE ' . USERS_TABLE . '
        SET user_online = 1
        WHERE '
 . $db->sql_in_set('user_id', $rows_user_id);
$db->sql_query($sql);

}
// Online Status on Team Page / 4seven / 2011          


find

Code:
u.user_posts, u.user_allow_pm,


replace with

Code:
u.user_posts, u.user_allow_pm, u.user_online,


find

Code:
            $template->assign_block_vars($which_row, array(
                'USER_ID'        => $row['user_id'],


after add

Code:
                'S_USER_ON'     => ($row['user_online'] == 1) ? true : false,


open

styles/prosilver/template/memberlist_leaders.html

find

Code:
        <td><!-- IF admin.RANK_IMG --> 


replace with

Code:
        <td><!-- IF admin.S_USER_ON --><img src="images/on.png" style="position:relative;top:4px;" alt="" /><!-- ELSE --><img src="images/off.png" style="position:relative;top:4px;" alt="" /><!-- ENDIF --><!-- IF admin.RANK_IMG --> 


find

Code:
        <td><!-- IF mod.RANK_IMG --> 


replace with
Code:

        
<td><!-- IF mod.S_USER_ON --><img src="images/on.png" style="position:relative;top:4px;" alt="" /><!-- ELSE --><img src="images/off.png" style="position:relative;top:4px;" alt="" /><!-- ENDIF --><!-- IF mod.RANK_IMG --> 


Clear all Caches

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic TOPIC_LOCKED  [ 2 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.015s | 24 Queries | GZIP : Off ]