Main Menu
collapse

Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

User Info

Welcome Guest.
Please log in.

Who's Online

  • Dot Guests: 1178
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]


Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Users Online needs updating

Started by Old Fossil, May 08, 2009, 05:56:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Old Fossil

Would someone be able to add spiders and users in chat to our users online block for us?


Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Blue

Hum... What chat are you referring to?
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Old Fossil

We use Ajax chat which we are still learning ( installed a day ago)

but how do we get the bit which says how many are in chat into the whos online section on the portal?
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Blue

Try this:
<?php//WHO'S ONLINE DASHBOARD	global $txt, $user_info, $sourcedir, $modSettings, $context, $settings, $scripturl, $db_prefix;	//users in chat	if (!WIRELESS){		$userIDs = chatOnlineUsers();		$context['chat_links'] = array();		if (count($userIDs) > 0){			$query = "SELECT mem.ID_MEMBER, mem.realName, mem.ID_GROUP, mg.onlineColor, mg.ID_GROUP			 FROM	{$db_prefix}members AS mem 			 LEFT JOIN {$db_prefix}membergroups AS mg ON 			 (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))WHERE ";			foreach ($userIDs as $ID)				$query .= 'ID_MEMBER = '. $ID . ' OR ';			//remove the last OR			$query = substr($query, 0, strlen($query)-3);			$result = db_query($query, __FILE__, __LINE__);			while ($row = mysql_fetch_assoc($result))				{				$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'];				if($row['onlineColor'] != ""){					$link.= '" style="color: ' . $row['onlineColor'];				}				$link.= '">' . $row['realName'] . '</a>';	   		array_push($context['chat_links'], $link);				}			mysql_free_result($result);			}		//set the flag true for home page		$context['chat_isHome'] = true;		}	//end ajax chat		$query = '		SELECT			lo.id_member, lo.log_time, mem.real_name, mem.member_name, mem.show_online,			mg.online_color, mg.id_group		FROM {$db_prefix}log_online AS lo			LEFT JOIN {$db_prefix}members AS mem ON (mem.id_member = lo.id_member)			LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.id_group = IF(mem.id_group = 0, mem.id_post_group, mem.id_group))'	);				$online['users'] = array();	$online['guests'] = 0;	$online['hidden'] = 0;	$online['buddies'] = 0;	$show_buddies = !empty($user_info['buddies']);	while ($row = mysql_fetch_assoc($result))	{		if (!isset($row['real_name']))			$online['guests']++;		elseif (!empty($row['show_online']) || allowedTo('moderate_forum'))		{			if (!empty($row['online_color']))				$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';			else				$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';			if ($show_buddies && in_array($row['id_member'], $user_info['buddies']))			{				$online['buddies']++;				$link = '<b>' . $link . '</b>';			}			$online['users'][$row['log_time'] . $row['member_name']] = array(				'id' => $row['id_member'],				'username' => $row['member_name'],				'name' => $row['real_name'],				'group' => $row['id_group'],				'href' => $scripturl . '?action=profile;u=' . $row['id_member'],				'link' => $link,				'hidden' => empty($row['show_online']),				'is_last' => false,			);		}		else			$online['hidden']++;	}	mysql_free_result($result);	if (!empty($online['users']))	{		krsort($online['users']);		$userlist = array_keys($online['users']);		$online['users'][$userlist[count($userlist) - 1]]['is_last'] = true;	}	$online['num_users'] = count($online['users']) + $online['hidden'];	$online['total_users'] = $online['num_users'] + $online['guests'];	echo '	<ul style="padding: 0.2em 0.4em 0.2em 0.4em;">		<li>			', sp_embed_image('dot'), ' Guests: ', $online['guests'],'		</li>		<li>			', sp_embed_image('dot'), ' Hidden: ', $online['hidden'],'		</li>			<li>			', sp_embed_image('dot'), ' Users: ', $online['num_users'],'		</li>		<li>			', sp_embed_image('dot'), ' In Chat: ' . count($context['chat_links']) . '		</li>';			if(!empty($online['users'])) {		echo '		<li>			', sp_embed_image('dot'), ' Users Online:		</li>';		foreach ($online['users'] as $user)			echo '		<li style="padding-left: 20px;">				', sp_embed_image('user'), ' ', $user['hidden'] ? '<em>' . $user['link'] . '</em>' : $user['link'],'		</li>';	}		// users in chat	if (isset($context['chat_links'])){		if (count($context['chat_links']) == 0 )  		echo '<br />' . $txt['chat_no_user'];		elseif (count($context['chat_links']) == 1 )	  	echo '<br />  1' . $txt['chat_aUser']. ':<br />', implode($context['chat_links']);		else  		echo '<br /> ' . count($context['chat_links']). $txt['chat_users']. ':<br />', implode(', ', $context['chat_links']);  }	echo '	</ul>';
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Old Fossil

Where should I put it?

Am no good at manual installing unless you mean it to go into a block.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

[SiNaN]

I haven't tested it but it should go in a PHP block.
And slowly, you come to realize... It's all as it should be...

Old Fossil

Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

ディン1031

Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Old Fossil

Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

[SiNaN]

Sources/SPortal1-1.php

Code (Find) Select
<li>', sp_embed_image('dot'), ' ', $txt['users'], ': ', $stats['num_users'], '</li>';

Code (Replace) Select
<li>', sp_embed_image('dot'), ' Spiders: ', $stats['num_spiders'], '</li>
<li>', sp_embed_image('dot'), ' ', $txt['users'], ': ', $stats['num_users'], '</li>
<li>', sp_embed_image('dot'), ' Users in chat: ', count(chatOnlineUsers()), '</li>';
And slowly, you come to realize... It's all as it should be...

Old Fossil

Completey forgot about this topic.

Sorry Folks.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast