Scoop -- the swiss army chainsaw of content management
Front Page Everything News Code Help! Wishlist Project Scoop Sites Dev Notes Latest CVS changes Development Activities
Scoop Box Exchange - Show Box: whos_online 1.00

Author: Scoop Developers


This box updates its cache every 30 min of whose been viewing the site. It shows whose online, with a link to their user info. Anonymous users are listed in bulk ( i.e. Anonymous(50) ). Users can cloak themselves from this box via their display preferences page from their user_box

Box Code:

## begin whos_online
return if $S->{UID} == -1;
if (($S->cache->{CACHE}->{WHOBOX}->{TIME}) &&
($S->cache->{CACHE}->{WHOBOX}->{TIME} < (time + 120))) {
return {
content => $S->cache->{CACHE}->{WHOBOX}->{CONTENT},
title => $S->cache->{CACHE}->{WHOBOX}->{TITLE}

require Storable;

my $interval = 5;
my ($rv,$sth) = $S->db_select({
FROM => 'sessions',
WHAT => 'a_session',
WHERE => "last_accessed > DATE_SUB(NOW(), INTERVAL $interval MINUTE)",
ORDER_BY => 'last_accessed DESC',
DEBUG => 0

my %uids;
my $total;
while (my ($s) = $sth->fetchrow_array) {
my $d = Storable::thaw($s);

next if $d->{UID} eq '';
$uids{ $d->{UID} } = 0 unless $uids{ $d->{UID} };
$uids{ $d->{UID} }++;

my @sorted = sort {
return 1 if $a == -1; return -1 if $b == -1; return 0;
} keys %uids;
return unless @sorted;

$S->user_data(\@sorted); # pre-cache user data

my $out;
my $hidden;
my $list;
my $max_show = 75;
foreach (@sorted) {
$_ = -1 if $_ eq 'anon';
if ($S->user_data($_)->{prefs}->{online_cloak}) {
next unless (($list < $max_show) || $_ == -1);
$list++ unless $_ == -1;
my $nick = $S->user_data($_)->{nickname};
my $linknick = $S->urlify($nick);
$out .= qq~%%dot%%~;
$out .= qq~ <A HREF="%%rootdir%%/user/$linknick">~ unless $_ == -1;
$out .= ' ' if $_ == -1;
$out .= $nick;
$out .= "</A>" unless $_ == -1;
$out .= " ($uids{$_})" if $uids{$_} > 1;
$out .= "<BR>\n";

if ($total > ($list + $hidden + $uids{-1})) {
my $more = ($total - $list - $hidden - $uids{-1});
$out .= qq~%%dot%% ...and $more more. :-)<br>~;

if ($hidden) {
$out .= qq~%%dot%% Cloaked Users ($hidden)<p>~;
} else {
$out .= '<p>';

$out .= qq~<small>
$interval minute interval.<br>You may cloak yourself from appearing here in your <A HREF="%%rootdir%%/interface/prefs">Display Preferences</A></small>.~;

my $title = "Who's Online? ($total)";

$S->cache->{CACHE}->{WHOBOX}->{CONTENT} = $out;
$S->cache->{CACHE}->{WHOBOX}->{TITLE} = $title;
$S->cache->{CACHE}->{WHOBOX}->{TIME} = time;

return {content => $out, title => $title};
Display: Sort:
tyty (none / 0) (#1)
by SCOOP44 on Mon Jul 22, 2019 at 01:20:35 AM PST

Really enjoyed this blog article.Much thanks again. Much obliged. jual ready mix

Re: (none / 0) (#2)
by PamelaATorres on Thu Jul 25, 2019 at 03:01:15 AM PST

Thanks for sharing this very important and useful source code for developers and I hope they really enjoy this to use. From I get different useful codes for myself and it's become a very useful site for me.

mtom (none / 0) (#3)
by mtom78632 on Wed Jan 29, 2020 at 06:53:10 AM PST

You produced some decent points there. I looked on the internet for the problem and discovered most individuals go in addition to with all your website. Fitzrovia barbers

mtom (none / 0) (#4)
by mtom78632 on Sat Feb 22, 2020 at 04:56:39 AM PST

Hello, Neat post. There is a problem with your site in web explorer, might check this... IE nonetheless is the marketplace leader and a big component to other people will omit your wonderful writing due to this problem. 예스카지노 ========------------------------------------------------- I and my guys were actually going through the best tips and tricks found on the blog and quickly developed an awful feeling I had not thanked you for those strategies. All the boys happened to be totally thrilled to learn them and now have clearly been enjoying those things. Many thanks for genuinely very accommodating and for having variety of amazing subjects most people are really desperate to discover. Our own sincere regret for not saying thanks to you earlier. 더킹카지노 주소

mtom (none / 0) (#5)
by mtom78632 on Mon Mar 23, 2020 at 08:40:49 AM PST

I visited a lot of website but I conceive this one holds something special in it. CBD for sale

create account
report bugs
Scoop Administrators Guide
Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
It's 4:19... do you know where your bong is?

Make a new account

Hosted by Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest 1999 The Management

create account | faq | search