TinyPortal

Development => Block Codes => Topic started by: haktanir on February 21, 2006, 09:29:49 AM

Title: Users online
Post by: haktanir on February 21, 2006, 09:29:49 AM
Could someone pls tell me the code for showing users online, without showing the whole stats box?
Title: Re: Users online
Post by: feline on February 21, 2006, 09:47:55 AM
create a php block and use ssi function
ssi_whosOnline()

Fel
Title: Re: Users online
Post by: haktanir on February 21, 2006, 09:57:12 AM
I've been trying that but just get an empty box.

I chhose PHP box and enter exactly what u said.
Title: Re: Users online
Post by: crip on February 21, 2006, 10:12:20 AM
try it like this in php box     ssi_whosOnline();
Title: Re: Users online
Post by: haktanir on February 21, 2006, 10:17:42 AM
yes thank you that worked!  :)
Title: Re: Users online
Post by: feline on February 21, 2006, 10:21:25 AM
spend crip many, many ";" for all I forgott  :2funny:
Title: Re: Users online
Post by: haktanir on February 21, 2006, 10:25:03 AM
lol

by the way is there a way to make the font smaller within this box?
Title: Re: Users online
Post by: crip on February 21, 2006, 10:36:30 AM
Quote from: haktanir on February 21, 2006, 10:25:03 AM
lol

by the way is there a way to make the font smaller within this box?

not sure, i think it goes along with whatever your Theme font size is..?
Title: Re: Users online
Post by: haktanir on February 21, 2006, 10:44:45 AM
yup it goes with standard font size
I was hoping og having the names smaller like in the default stats box
Title: Re: Users online
Post by: feline on February 21, 2006, 10:49:29 AM
try this in your box:

echo '<span class="smalltext">';
ssi_whosOnline();
echo '</span>';


Fel
Title: Re: Users online
Post by: haktanir on February 21, 2006, 10:54:54 AM
Excellent! Thank you very much.  :)
Title: Re: Users online
Post by: RoarinRow on May 20, 2006, 04:20:01 PM
Quote from: feline on February 21, 2006, 10:49:29 AM
try this in your box:

echo '<span class="smalltext">';
ssi_whosOnline();
echo '</span>';


Fel

I really like this code Fel.  How do you make it so that you can click on the first line that tells you the number of Guests and Users, that it brings you to the '?action=who' screen.  That would save me a couple of clicks.   ;)

Title: Re: Users online
Post by: RoarinRow on May 22, 2006, 08:22:13 PM
Quote from: RoarinRow on May 20, 2006, 04:20:01 PM
Quote from: feline on February 21, 2006, 10:49:29 AM
try this in your box:

echo '<span class="smalltext">';
ssi_whosOnline();
echo '</span>';


Fel

I really like this code Fel.  How do you make it so that you can click on the first line that tells you the number of Guests and Users, that it brings you to the '?action=who' screen.  That would save me a couple of clicks.   ;)



Bump.  Anyone?   :uglystupid2:
Title: Re: Users online
Post by: serhat on June 19, 2006, 12:12:50 PM
thanks
Title: Re: Users online
Post by: Nokonium on June 20, 2006, 07:16:10 AM
In the next release of TP it will be there in the Stats block (I hope) as it is on here

The specific code line you want is

<a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a>
Title: Re: Users online
Post by: RoarinRow on August 30, 2006, 06:06:03 PM
Quote from: nokonium on June 20, 2006, 07:16:10 AM
In the next release of TP it will be there in the Stats block (I hope) as it is on here

The specific code line you want is

<a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a>

How would you combine the two with what you have and

ssi_whosOnline();
Title: Re: Users online
Post by: akulion on August 30, 2006, 06:22:38 PM
like this...



echo '<a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br>
<span class="smalltext">';
ssi_whosOnline();
echo '</span>';

Title: Re: Users online
Post by: RoarinRow on August 30, 2006, 06:28:52 PM
Quote from: akulion on August 30, 2006, 06:22:38 PM
like this...



echo '<a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br>
<span class="smalltext">';
ssi_whosOnline();
echo '</span>';



Awesome!! thank you!   :up:
Title: Re: Users online
Post by: akulion on August 30, 2006, 07:08:38 PM
ur welcome
Title: Re: Users online
Post by: rebelrose on September 17, 2006, 07:11:01 PM
Quote from: akulion on August 30, 2006, 06:22:38 PM
like this...



echo '<a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br>
<span class="smalltext">';
ssi_whosOnline();
echo '</span>';



Could this be done using the icon as well, how would that be coded?
Title: Re: Users online
Post by: Thurnok on September 18, 2006, 01:37:17 AM
If you want the image to be part of the link:
echo '<a href="'.$scripturl.'?action=who"><img src="'.$settings['actual_images_url'].'/icons/online.gif'.'"  /> <b>'.$txt[158].'</b></a><br>
<span class="smalltext">';
ssi_whosOnline();
echo '</span>';


Otherwise:
echo '<img src="'.$settings['actual_images_url'].'/icons/online.gif'.'"  /> <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br>
<span class="smalltext">';
ssi_whosOnline();
echo '</span>';
Title: Re: Users online
Post by: rebelrose on September 18, 2006, 01:49:46 AM
Great thank you so much
Title: Re: Users online
Post by: rebelrose on September 18, 2006, 11:00:25 PM
Can you make it show in a list, like it does in the TP block?
Title: Re: Users online
Post by: Crip on September 18, 2006, 11:02:18 PM
u mean scroll?
Title: Re: Users online
Post by: rebelrose on September 18, 2006, 11:03:36 PM
No, in the TP Stats Block, it has:

Users online
user one
user two
user there
and so on
Title: Re: Users online
Post by: Thurnok on September 19, 2006, 12:07:27 AM
That's a function of the SSI.php code.  You would have to change the function there.
Title: Re: Users online
Post by: rebelrose on September 21, 2006, 07:46:58 PM
ok thanks
Title: Re: Users online
Post by: mnichols7 on August 05, 2008, 12:07:33 AM
Going to try this one.  ;D
Title: Re: Users online
Post by: mcardo99 on December 21, 2008, 08:27:29 AM
I'd be interested in a snippet that will show you the Avatar (as a link to the user's profile) and the user name to the avatar's right. =D thank you!
Title: Re: Users online
Post by: ZarPrime on December 21, 2008, 11:22:04 AM
Quote from: mcardo99 on December 21, 2008, 08:27:29 AM
I'd be interested in a snippet that will show you the Avatar (as a link to the user's profile) and the user name to the avatar's right. =D thank you!

mcardo,

How about user name below the avatar?  Have a look at my site.  I have 2 blocks setup that show the avatar as a link with name below, one near the top of the front page (users online for the last 60 minutes) and one at the bottom of the front page (users online in the last 24 hours).  If you want to see how it looks, my page is at http://forum.talesofthehavenexpanse.com

If this is what you want, this is a block code snippet done recently by Ichbin.  You can find it here ---> http://www.tinyportal.net/index.php/topic,27231.msg216822.html#msg216822

Suggest you read the whole thread. ;D

ZarPrime
Title: Re: Users online
Post by: mcardo99 on December 21, 2008, 06:10:51 PM
Thank you so much!!! =)
Title: Re: Users online
Post by: Atomiq25 on May 23, 2010, 08:56:37 AM
it pisses me of that when i use this code shows other stuff like how many are guests and buddies

is there any way i can just show ONLINE members?
Title: Re: Users online
Post by: IchBin on May 23, 2010, 08:23:20 PM
There are a few of the online members ones. I have a couple of them that show avatars and member name of members online. What exactly are you looking for? Just names?
Title: Re: Users online
Post by: Atomiq25 on May 27, 2010, 11:50:51 PM
name and avatar

with option of scrolling or not

--

and a way to show avatars on buddy list

i'm using this code:

Quote

global $scripturl, $db_prefix, $user_info, $txt;
        echo '<center><img src="URL-OF-FORUM/TITTLE-IMAGE.png" border="0" /><p>';
// Load the users online right now.
$result = db_query("
   SELECT
      lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
      mg.onlineColor, 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))", __FILE__, __LINE__);

$return['users'] = array();
$return['buddies'] = 0;
$show_buddies = !empty($user_info['buddies']);

while ($row = mysql_fetch_assoc($result))
{
        if (in_array($row['ID_MEMBER'], $user_info['buddies']) && (!empty($row['showOnline']) || allowedTo('moderate_forum')))
   {
      $return['buddies']++;
      // Some basic color coding...
      if (!empty($row['onlineColor']))
         $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
      else
         $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

      $return['users'][$row['logTime'] . $row['memberName']] = array(
         'id' => $row['ID_MEMBER'],
         'username' => $row['memberName'],
         'name' => $row['realName'],
         'group' => $row['ID_GROUP'],
         'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
         'link' => $link,
         'hidden' => empty($row['showOnline']),
         'is_last' => false,
      );
   }
}
mysql_free_result($result);

if (!empty($return['users']))
{
   krsort($return['users']);
   $userlist = array_keys($return['users']);
   $return['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
        foreach ($return['users'] as $user)
           echo $user['hidden'] ? '' . $user['link'] . '' : $user['link'], $user['is_last'] ? '' : ', ';
}
else
        echo '<span class="smalltext" >None of your friends are online.</span>';
       
       echo '
<p><li><a href="http://URL-OF-FORUM/index.php?action=profile;sa=editBuddies" ><span class="smalltext" >Edit buddies</span></a></li><li><a href="http://URL-OF-FORUM/index.php?action=mlist;sa=search" ><span class="smalltext" >Find your buddies</span></a></li>
';

echo '<img src="http://URL-OF-FORUM/TITTLE-IMAGE.png" border="0" /><p>';

ssi_whosOnline();

echo '</center>';


i'm using smf 1.1.11 and tp 1.0 beta 4
Title: Re: Users online
Post by: IchBin on May 28, 2010, 04:24:46 PM
http://www.tinyportal.net/index.php?topic=31671.0
http://www.tinyportal.net/index.php?topic=31672.0
Title: Re: Users online
Post by: Atomiq25 on May 29, 2010, 03:22:58 AM
Quote from: IchBinâ„¢ on May 28, 2010, 04:24:46 PM
http://www.tinyportal.net/index.php?topic=31671.0
http://www.tinyportal.net/index.php?topic=31672.0

how about one of those but to show buddies online..? (with avatar)

thanks for the links ; )
Title: Re: Users online
Post by: IchBin on May 29, 2010, 08:07:14 PM
You should put a request in the requests board if you're looking for something specific.
Title: Re: Users online
Post by: Atomiq25 on May 30, 2010, 11:25:08 PM
cool, thanks tho.