News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Getting users online and online today

Started by Scareface, October 10, 2015, 10:19:26 AM

Previous topic - Next topic

Scareface

Hello guys, I'm trying to get most online and user online now.

For users online I tried $context['users_online'] but it's not working. However $context['common_stats']['total_topics'] seems to be working but context user online doesn't seem to work.

For most online today , $context['online_today'] doesn't seem to be working but comma_format($modSettings['mostOnlineToday']) works.

I don't get whats the problem with $context. For some its working and for some its not.

I have included SSI.php and $context, $settings, $txt, $scripturl, $modSettings as global.

Any help would be appreciated.

C. Davis

Heres a thread from a few days ago. You pretty much call a function that you can see in the example.

http://www.simplemachines.org/community/index.php?topic=420369.msg3840698#msg3840698

Scareface

$membersOnlineOptions = array(
'show_hidden' => allowedTo('moderate_forum'),
'sort' => 'log_time',
'reverse_sort' => true,
);

$return = getMembersOnlineStats($membersOnlineOptions);
  $onlinenow = count($return['list_users_online']);

   
I'm getting a value through this as 1. I'm not able to test it as I'm the only one user in my localhost. But is this correct way ?

C. Davis

If you want the number of user online, It looks good to me.

Advertisement: