[REL] Add Online-Status to Team Block

Forum rules
This forum is not for support requests.

Only post Modifications for Board3 Portal 1.0.x in this forum.
User avatar

Topic author
Marc
Dev
Dev
Posts: 2488
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München

[REL] Add Online-Status to Team Block

Post by Marc »

This will add the online status to the team block. Durch dies Anleitung wird der Online Status im Team-Block angezeigt.

Version: 1.0.0

Screenshot:
screenshot.png
Tested with Board3 Portal 1.0.4 & 1.0.5. Getestet mit Board3 Portal 1.0.4 & 1.0.5

Normal Team block / Normaler Team Block

Instructions for normal team block:
[+] Install Instructions
Open portal/block/leaders.php
Find:

Code: Select all

    if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])
    {
        $group_name = $user->lang['GROUP_UNDISCLOSED'];
        $u_group = '';
    }
    else
    {
        $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
        $u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']);
    }  
After add:

Code: Select all

    // Generate online information for user
    $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
        FROM ' . SESSIONS_TABLE . '
        WHERE ' . $db->sql_in_set('session_user_id', $row['user_id']) . '
        GROUP BY session_user_id';
    $result2 = $db->sql_query($sql);

    $update_time = $config['load_online_time'] * 60;
    $user_online = false;
    while ($row2 = $db->sql_fetchrow($result2))
    {
        $user_online = (time() - $update_time < $row2['online_time'] && (($row2['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
    }
    $db->sql_freeresult($result2);  
Find:

Code: Select all

        'USER_ID'            => $row['user_id'],  
After add:

Code: Select all

        'USER_ONLINE'        => $user_online,  

Open styles/prosilver/template/portal/block/leaders.html
Find:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{admin.USERNAME_FULL}</strong></span>
Inline: After add:

Code: Select all

<!-- IF admin.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF -->
Find:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{mod.USERNAME_FULL}</strong></span>
Replace with:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{mod.USERNAME_FULL}</strong></span><!-- IF mod.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF -->
Upload the following 2 files to styles/prosilver/theme/images/portal:
green-on-16.png
red-on-16.png
Anleitung für normalen Team Block:
[+] Installations Anleitung
Öffne portal/block/leaders.php
Finde:

Code: Select all

    if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])
    {
        $group_name = $user->lang['GROUP_UNDISCLOSED'];
        $u_group = '';
    }
    else
    {
        $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
        $u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']);
    }  
Danach einfügen:

Code: Select all

    // Generate online information for user
    $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
        FROM ' . SESSIONS_TABLE . '
        WHERE ' . $db->sql_in_set('session_user_id', $row['user_id']) . '
        GROUP BY session_user_id';
    $result2 = $db->sql_query($sql);

    $update_time = $config['load_online_time'] * 60;
    $user_online = false;
    while ($row2 = $db->sql_fetchrow($result2))
    {
        $user_online = (time() - $update_time < $row2['online_time'] && (($row2['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
    }
    $db->sql_freeresult($result2);  
Finde:

Code: Select all

        'USER_ID'            => $row['user_id'],  
Danach einfügen:

Code: Select all

        'USER_ONLINE'        => $user_online,  

Öffne styles/prosilver/template/portal/block/leaders.html
Finde:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{admin.USERNAME_FULL}</strong></span>
In der Zeile direkt danach einfügen:

Code: Select all

<!-- IF admin.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF -->
Finde:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{mod.USERNAME_FULL}</strong></span>
Ersetze mit:

Code: Select all

<span style="float:left; padding-left:5px; padding-top:2px;"><strong>{mod.USERNAME_FULL}</strong></span><!-- IF mod.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF -->
Jetzt noch die folgenden 2 Dateien in styles/prosilver/theme/images/portal hochladen:
green-on-16.png
red-on-16.png
Extended Team block / Erweiterter Team Block

Instructions for extended team block:
[+] Install Instructions
Open portal/block/leaders_ext.php
Find:

Code: Select all

        $groups[$row['group_id']]['group_users'][] = array(
            'user_id'        => $row['user_id'],
            'username'        => $row['username'],
            'user_colour'    => $row['user_colour'],
        );  
Before add:

Code: Select all

        // Generate online information for user
        $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
            FROM ' . SESSIONS_TABLE . '
            WHERE ' . $db->sql_in_set('session_user_id', $row['user_id']) . '
            GROUP BY session_user_id';
        $result2 = $db->sql_query($sql);

        $update_time = $config['load_online_time'] * 60;
        $user_online = false;
        while ($row2 = $db->sql_fetchrow($result2))
        {
            $user_online = (time() - $update_time < $row2['online_time'] && (($row2['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
        }
        $db->sql_freeresult($result2);  
Find:

Code: Select all

'user_id'        => $row['user_id'],  
After add:

Code: Select all

            'user_online'    => $user_online,  
Find:

Code: Select all

                    'USER_ID'            => $group_user['user_id'],  
After add:

Code: Select all

                    'USER_ONLINE'        => $group_user['user_online'],  

Open styles/prosilver/template/portal/block/leaders_ext.html
Find:

Code: Select all

		<span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><strong>{group.member.USERNAME_FULL}</strong></span><br style="clear:both" />
Replace with:

Code: Select all

		<span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><strong>{group.member.USERNAME_FULL}</strong></span><!-- IF group.member.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF --><br style="clear:both" />
Upload the following 2 files to styles/prosilver/theme/images/portal hochladen (if the do not already exist):
green-on-16.png
red-on-16.png
Anleitung für Erweiterten Team-Block:
[+] Installations Anleitung
Öffne portal/block/leaders_ext.php
Finde:

Code: Select all

        $groups[$row['group_id']]['group_users'][] = array(
            'user_id'        => $row['user_id'],
            'username'        => $row['username'],
            'user_colour'    => $row['user_colour'],
        ); 
Davor einfügen:

Code: Select all

        // Generate online information for user
        $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
            FROM ' . SESSIONS_TABLE . '
            WHERE ' . $db->sql_in_set('session_user_id', $row['user_id']) . '
            GROUP BY session_user_id';
        $result2 = $db->sql_query($sql);

        $update_time = $config['load_online_time'] * 60;
        $user_online = false;
        while ($row2 = $db->sql_fetchrow($result2))
        {
            $user_online = (time() - $update_time < $row2['online_time'] && (($row2['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
        }
        $db->sql_freeresult($result2); 
Finde:

Code: Select all

'user_id'        => $row['user_id'], 
Danach einfügen:

Code: Select all

            'user_online'    => $user_online, 
Finde:

Code: Select all

                    'USER_ID'            => $group_user['user_id'], 
Danach einfügen:

Code: Select all

                    'USER_ONLINE'        => $group_user['user_online'], 

Öffne styles/prosilver/template/portal/block/leaders_ext.html
Finde:

Code: Select all

		<span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><strong>{group.member.USERNAME_FULL}</strong></span><br style="clear:both" />
Ersetze durch:

Code: Select all

		<span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><strong>{group.member.USERNAME_FULL}</strong></span><!-- IF group.member.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF --><br style="clear:both" />
Jetzt noch die folgenden 2 Dateien in styles/prosilver/theme/images/portal hochladen (falls nicht schon vorhanden):
green-on-16.png
red-on-16.png
Note: The png-leds will not have a transparent background in IE6. If you want it to look correct in IE6, look for GIF led-icons.
Hinweis: Die PNG-LEDs haben im IE6 keinen transparenten Hintergrund. Falls du willst, dass es im IE6 auch gut aussieht, suche LED-Icons im GIF-Format.
You do not have the required permissions to view the files attached to this post.

Hoplita
Active Member
Active Member
Posts: 2
Joined: 24. January 2010 20:35

Re: [REL] Add Online-Status to Team Block

Post by Hoplita »

For some reason, i see the name of the users 2 times under Moderators,
see http://northseapirates.co.cc/

Any Idea,

Best Regards
User avatar

Topic author
Marc
Dev
Dev
Posts: 2488
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München

Re: [REL] Add Online-Status to Team Block

Post by Marc »

There was an error in the install instructions. The instructions have been updated. Check the second edit of styles/prosilver/template/portal/block/leaders.html.

Hoplita
Active Member
Active Member
Posts: 2
Joined: 24. January 2010 20:35

Re: [REL] Add Online-Status to Team Block

Post by Hoplita »

Fixed Thanks,
Nice done btw

Hanner72
Active Member
Active Member
Posts: 2
Joined: 25. July 2010 21:51

Re: [REL] Add Online-Status to Team Block

Post by Hanner72 »

Hi,

Hab den Online-Status auf meiner Page installiert, doch dieser funktioniert nicht.
Hier der Beweis und meine Dateien.
Bitte um Hilfe.
Hier der Link zu meiner Seite: www.varc.at

Hier der Online-Status im Center-Block wo ich online bin
Image


Hier der modifizierte Team-Block wo ich offline sein soll, bin aber online
Image

leaders_ext.php

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: leaders_ext.php 578 2009-11-20 09:34:35Z marc1706 $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
   exit;
}

// Display a listing of board admins, moderators
$user->add_lang('groups');

$legends = array();
$groups = array();

if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
	$sql = 'SELECT group_id, group_name, group_colour, group_type
		FROM ' . GROUPS_TABLE . '
		WHERE group_legend = 1
		ORDER BY group_name ASC';
}
else
{
	$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
		FROM ' . GROUPS_TABLE . ' g
		LEFT JOIN ' . USER_GROUP_TABLE . ' ug
			ON (
				g.group_id = ug.group_id
				AND ug.user_id = ' . $user->data['user_id'] . '
				AND ug.user_pending = 0
			)
		WHERE g.group_legend = 1
			AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
		ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{
	$groups[$row['group_id']] = array(
		'group_name'	=> $row['group_name'],
		'group_colour'	=> $row['group_colour'],
		'group_type'	=> $row['group_type'],
		'group_users'	=> array(),
	);
	$legends[] = $row['group_id'];
}
$db->sql_freeresult($result);

if(sizeof($legends))
{
	$sql = 'SELECT
				u.user_id, u.username, u.user_colour, u.group_id
			FROM
				' . USERS_TABLE . ' AS u
			WHERE
				'. $db->sql_in_set('u.group_id', $legends) . '
			ORDER BY u.username ASC';
	$result = $db->sql_query($sql);

	while ($row = $db->sql_fetchrow($result))
	{
		$groups[$row['group_id']]['group_users'][] = array(
			'user_id'		=> $row['user_id'],
                'user_online'    => $user_online, 
			'username'		=> $row['username'],
			'user_colour'	=> $row['user_colour'],
		);


            // Generate online information for user
            $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
                FROM ' . SESSIONS_TABLE . '
                WHERE ' . $db->sql_in_set('session_user_id', $row['user_id']) . '
                GROUP BY session_user_id';
            $result2 = $db->sql_query($sql);

            $update_time = $config['load_online_time'] * 60;
            $user_online = false;
            while ($row2 = $db->sql_fetchrow($result2))
            {
                $user_online = (time() - $update_time < $row2['online_time'] && (($row2['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
            }
            $db->sql_freeresult($result2); 



	}
	$db->sql_freeresult($result);
}

if(sizeof($groups))
{
	foreach($groups as $group_id => $group)
	{
		if(sizeof($group['group_users']))
		{
			$group_name = ($group['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group['group_name']] : $group['group_name'];
			$u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $group_id);

			$template->assign_block_vars('group', array(
				'GROUP_NAME'	=> $group_name,
				'GROUP_COLOUR'	=> $group['group_colour'],
				'U_GROUP'		=> $u_group,
			));

			foreach($group['group_users'] as $group_user)
			{
				$template->assign_block_vars('group.member', array(
					'USER_ID'			=> $group_user['user_id'],
                        'USER_ONLINE'        => $group_user['user_online'], 
					'USERNAME_FULL'		=> get_username_string('full', $group_user['user_id'], $group_user['username'], $group_user['user_colour']),
				));
			}
		}
	}
}

$template->assign_var('S_DISPLAY_LEADERS_EXT', true);

?>
leaders_ext.html

Code: Select all

<!--version $Id: leaders_ext.html 606 2010-01-19 22:46:35Z marc1706 $ //-->
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{T_THEME_PATH}/images/portal/portal_team.png" width="16" height="16" alt="" />&nbsp;<!-- ENDIF -->{L_THE_TEAM}{$LR_BLOCK_H_R}
<table class="tablebg" cellspacing="1" width="100%">
	<!-- BEGIN group -->
		<tr class="row3">
			<td>
				<strong><a href="{group.U_GROUP}" style="color: #{group.GROUP_COLOUR};" class="username-coloured">{group.GROUP_NAME}</a></strong>
			</td>
		</tr>
		<!-- BEGIN member -->
			<tr  class="row1">
				<td>
          <span style="float:left;"><img src="{T_THEME_PATH}/images/portal/portal_user.png" width="16" height="16" alt="" /></span><span style="float:left; padding-left:5px; padding-top:2px;"><strong>{group.member.USERNAME_FULL}</strong></span><!-- IF group.member.USER_ONLINE eq 'true' --><img src="{T_THEME_PATH}/images/portal/green-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ELSE --><img src="{T_THEME_PATH}/images/portal/red-on-16.png" width="16" height="16" alt="{L_ONLINE}" style="float: right;" /><!-- ENDIF --><br style="clear:both" />				</td>
			</tr>
		<!-- END member -->
	<!-- BEGINELSE -->
		<tr  class="row1">
			<td>
				{L_NO_GROUPS_P}
			</td>
		</tr>
	<!-- END group -->
</table>	
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
Bitte um Hilfe.

mfG
Johann

Hanner72
Active Member
Active Member
Posts: 2
Joined: 25. July 2010 21:51

Re: [REL] Add Online-Status to Team Block

Post by Hanner72 »

Hi,

Hat sich erledigt,

Hab in der leaders_ext.php die Daten noch nicht geändert. bzw. die originale datei wieder hochgeladen.

mfG

Artuax
Active Member
Active Member
Posts: 2
Joined: 8. September 2010 04:06

Re: [REL] Add Online-Status to Team Block

Post by Artuax »

Any plans for updating/checking for compatibility with 1.0.6 ?
User avatar

Topic author
Marc
Dev
Dev
Posts: 2488
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München

Re: [REL] Add Online-Status to Team Block

Post by Marc »

This should also work with Board3 Portal 1.0.6.

Return to “board3 Portal v1.0.x - Modifications”