WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
<?php MembersOnline(); ?>
<?php MembersOnline('600', 'users online', 'username', '-'); ?>
<?php MembersOnline('300', 'Active users in last 5 min', 'display_name', '0 users online'); ?>
function MembersOnline ($custom_timeout) { global $database; $timestamp = time(); if ($custom_timeout = null) { $my_timeout = "300"; } else { $my_timeout = $custom_timeout;} $timeout = $timestamp - $custom_timeout;....the rest of code stays as is}example:<?php MembersOnline(600); ?> => timeout 10 min<?php MembersOnline(); ?> => timeout 5 min
Perhaps more precise would be: "Active users in last 5 min: <list>"
And, regarding timeout, since this is a function, you can easily increase the timeout:
I want to show display_name and not user name. What should I do?
$username = $database->get_one("SELECT username FROM ".TABLE_PREFIX."users WHERE user_id = '".$row['user_id']."'");
$username = $database->get_one("SELECT display_name FROM ".TABLE_PREFIX."users WHERE user_id = '".$row['user_id']."'");
Thanks, it works. Can you write me why I always get one sized line.
this is a very nice snippet.
I suggest to use another parameter to have a choice between username || display_name, like:
BTW, there is another Snippet from User Ruud E. which creates a list of visitors who are not logged in.
Maybe it was a good idea to merge both, or extend this one to have a list of logged in users and a Number print of those not logged in?
Quote from: iradj on August 30, 2010, 01:39:40 PMThanks, it works. Can you write me why I always get one sized line.Sorry don't understand, do you mean the blank line (only the bullet) under your name?Perhaps you give me the link to your website so I can view it in action?
Yes exactly what I mean. URL is www.evgberg.de
$tpl->set_var(array("USERNAME" => $username));
if ($username) { $tpl->set_var(array("USERNAME" => $username)); }
Could you please post the original error that is displayed?
One Question: I miss the closing "?>" in the include.php above. Is it not necessary? I do not get any errors, but if it is working right I cant't check.
MembersOnline (604800, 'Login in den letzten 7 Tagen', 'display_name', '0 users online', 0);
Code: [Select]MembersOnline (604800, 'Login in den letzten 7 Tagen', 'display_name', '0 users online', 0); does not really work. Is the time too long or?
By the way Marmot's download "include.zip" is demaged. Can anyone take an upload again?
But why I cannot see a member who was logged in two days before when I ask the last seven days? Is this memory not asked or lost in the database?