Gossamer Forum
Home : Products : Others : Gossamer Community :

users online in glinks

Quote Reply
users online in glinks
Hi,
in community we have the tag <%users_online%>
Is there a way to display this in glinks
I tried this code
Code:
<%Plugins::Auth_Community::users_online%>
and this one
Code:
<%Plugins::Auth_Community::get_users_online%>
but both didn't work...

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] users online in glinks In reply to
Hi,

Those aren't valid routines =)

Try adding this to Auth_Community.pm (should work fine in GLinks and GForum);

Code:
sub get_users_online {

my $min = $IN->param('min') || 60;

my $cfg = Links::Plugins->get_plugin_user_cfg('Auth_Community');

my $NEWDB = new GT::SQL (
def_path => "$cfg->{community_private}/defs",
cache => 0,
debug => 0,
subclass => 1
);


require GT::SQL::Condition;
my $db = $NEWDB->table('comm_users', 'comm_sessions');
my $cd = GT::SQL::Condition->new(
'sess_expire', '>=', time,
'sess_accessed', '>=', time - ($min * 60)
);

my $count = $db->count($cd) || die $GT::SQL::error;

return $count;

}

Then, call with:

Code:
<%Plugins::Auth_Community::get_users_online%>

Hope that helps.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] users online in glinks In reply to
Hi Andy,
works very very perfect. What else ;-)
Thanks
Matthias

Matthias
gpaed.de