- 20
- Mar
$loggedinusers
$pminfo
to the forumdisplay template but nothing happened. Do i need to add something in the forumdisplay php code or something?
Any pointers appreciated :)
i have put $loggedinusers in forumdisplay_threadlist template
$templatesused.='timezone,username_loggedout,usern ame_loggedin,phpinclude,headinclude,header,footer, toplinks,forumjumpbit,forumjump,nav_linkoff,nav_li nkon,navbar,nav_joiner';
cachetemplates($templatesused);
thanks for the pointer
Also on this subject, i wanted to create a tempate which i could then call from the header (or elsewhere) how do i do this? sorry if this is a silly question but not sure.
As mentioned above you need to copy some *stuff* from index.php to global.php
Open index.php
Find:
if ($displayloggedin) {
$datecut=time()-$cookietimeout;
//$loggedins=$DB_site->query_first("SELECT COUNT(*) AS sessions FROM session WHERE lastactivity>$datecut");
//$totalonline=$loggedins['sessions'];
$loggedins=$DB_site->query_first("SELECT COUNT(*) AS sessions FROM session WHERE userid=0 AND lastactivity>$datecut");
$numberguest=$loggedins['sessions'];
//$numberregistered=$totalonline-$numberguest;
$numbervisible=0;
$numberregistered=0;
//$loggedins=$DB_site->query("SELECT DISTINCT user.userid,username FROM user,session WHERE session.userid=user.userid AND session.userid<>0 AND invisible=0 AND session.lastactivity>$datecut ORDER BY username");
$loggedins=$DB_site->query("SELECT DISTINCT session.userid,username,invisible
FROM session
LEFT JOIN user ON (user.userid=session.userid)
WHERE session.userid>0 AND session.lastactivity>$datecut
ORDER BY invisible, username");
if ($loggedin=$DB_site->fetch_array($loggedins)) {
$numberregistered++;
if ($loggedin['invisible']==0 or $bbuserinfo['usergroupid']==6) {
$numbervisible++;
$userid=$loggedin['userid'];
if ($loggedin['invisible']==1) { // Invisible User but show to Admin
$username=$loggedin['username'];
$invisibleuser = '*';
} else {
$username=$loggedin['username'];
$invisibleuser = '';
}
//$location=$loggedin['location'];
eval("$activeusers = "".gettemplate('forumhome_loggedinuser')."";");
}
while ($loggedin=$DB_site->fetch_array($loggedins)) {
$numberregistered++;
$invisibleuser = '';
if ($loggedin['invisible']==1 and $bbuserinfo['usergroupid']!=6) {
continue;
}
$numbervisible++;
$userid=$loggedin['userid'];
if ($loggedin['invisible']==1) { // Invisible User but show to Admin
$username=$loggedin['username'];
$invisibleuser = '*';
} else {
$username=$loggedin['username'];
}
$location=$loggedin['location'];
eval("$activeusers .= ", ".gettemplate('forumhome_loggedinuser')."";");
}
}
$DB_site->free_result($loggedins);
$totalonline=$numberregistered+$numberguest;
$numberinvisible=$numberregistered-$numbervisible;
$maxusers=explode(" ", gettemplate('maxloggedin',0,0));
if ((int)$maxusers[0] <= $totalonline) {
$time = time();
$maxloggedin = "$totalonline " . $time;
$DB_site->query("UPDATE template SET template='$maxloggedin' WHERE title='maxloggedin'");
$maxusers[0] = $totalonline;
$maxusers[1] = $time;
}
$recordusers = $maxusers[0];
$recorddate = vbdate($dateformat,$maxusers[1]);
$recordtime = vbdate($timeformat,$maxusers[1]);
eval("$loggedinusers = "".gettemplate('forumhome_loggedinusers')."";");
}
and cut it from this file (once you have made a backup!)
Paste into global.php after:
$PHP_SELF = strtolower($PHP_SELF);
if (substr($PHP_SELF,-12)!='register.php' and substr($PHP_SELF,-10)!='member.php') {
$permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}
} else {
if ($action!="register" and $action!="signup" and $action!="activate" and $action!="login" and $action!="logout" and $action!="lostpw" and $action!="emailpassword" and $action!="addmember" and $action!="coppaform" and $a!="act" and $a!="ver") {
$permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}
}
}
Upload the files. Now edit your templates.
forumdisplay_forumslist - edit for logged in users in a forum view.
In forumdisplay_forumslist at the end where
$forumbits
Change to:
$forumbits
$loggedinusers
This works for me, I hope it works for anyone else that tries it - but I don't really know what I am doing, so if there are mistakes please point them out ;)
Couldn't be easier... well it could if all these variables were made global aready - but I supposed there is a reason for that such as extra server load? I dunno :)
#If you have any other info about this subject , Please add it free.# |