Page 1 of 1

Who's Online

Posted: 12. April 2010 21:47
by Cherry
What I am trying to do, is show the Who's online list, with a user on each line, but I have not found a way to do this yet.

My current code:

Code: Select all

<!--version $Id: whois_online.html 503 2009-04-20 18:34:29Z kevin74 $ //-->
{$C_BLOCK_H_L}<!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a><!-- ELSE -->{L_WHO_IS_ONLINE}<!-- ENDIF -->{$C_BLOCK_H_R}
<table class="tablebg" cellspacing="1" width="100%">
<tr>

	<td class="row1" width="100%"><span class="genmed"><span style="float:left;">{LOGGED_IN_USER_LIST}</span><br /></span></td>
</tr>

</table>
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
How could I get it to show a new user on each line, rather than being separated with a ",".

Re: Who's Online

Posted: 12. April 2010 22:44
by Huor
As far as i know the LOGGED_IN_USER_LIST is built in a php file (sorry dont know yet which one). But you need to edit this php file in order to display each user on a separate line. Hope this hint is useful. If not please tell.

Re: Who's Online

Posted: 13. April 2010 13:37
by Marc
phpBB actually assigns those values, therefore it doesn't have anything to do with the Portal.
I'll move the topic to General phpBB3 support.

Anyhow, this is what you need to do:
Open includes/functions.php
Find:

Code: Select all

$online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link; 
(Around line 3811)

Replace with:

Code: Select all

$online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link . '<br />' : $user_online_link . '<br />'; 

Re: Who's Online

Posted: 13. April 2010 14:24
by Cherry
Thanks very much, but is there a way to just make this vertical list show in the portal, and still show the horizontal one on the index page?

Re: Who's Online

Posted: 13. April 2010 16:44
by Marc
No, not as far as I know.

Re: Who's Online

Posted: 14. April 2010 00:37
by Huor
i am not sure if its working but i post it here - maybe someone else could verify it.

in the file /portal/block/whois_online.php

FIND:

Code: Select all

while ($row = $db->sql_fetchrow($result))
{
	$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';

	if ($row['group_name'] == 'BOTS')
	{
		$legend .= (($legend != '') ? ', ' : '') . '<span' . $colour_text . '>' . $user->lang['G_BOTS'] . '</span>';
	}
	else
	{
		$legend .= (($legend != '') ? ', ' : '') . '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';
	}
}

and replace the ', ' with a '<br />' )in the line legend .= .... :

Code: Select all

while ($row = $db->sql_fetchrow($result))
{
	$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';

	if ($row['group_name'] == 'BOTS')
	{
		$legend .= (($legend != '') ? '<br />' : '') . '<span' . $colour_text . '>' . $user->lang['G_BOTS'] . '</span>';
	}
	else
	{
		$legend .= (($legend != '') ? '<br />' : '') . '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';
	}
}

edit: Just figured out that the legend *knocksheadonthewall*. But I assume the user list can be inserted here as well in the assign_vars block and with a str_replace?