
01-10-2005, 02:03 PM
|
|
|
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by Mosaicvb
I just installed this mod with vb 3.0.5 and it works great. I made some changes and I am posting what I did if you want to have an option that does not require altering the index.php.
1 : create a php file called whos.online.today.php with the following and upload to the root of the forum. :
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
$now = TIMENOW ;
require_once('./includes/functions_misc.php');
$cutoff = vbmktime(0, 0, 0, vbdate('m', $now. false, false), vbdate('d', $now. false, false), vbdate('Y', $now. false, false));
//$cutoff = $now - 86400 ; // Uncomment this line if you don't have vB 3.0.3 and all users are showing.
$todaysusers = $DB_site->query("SELECT userid, lastactivity, options, username, opentag, closetag
FROM " . TABLE_PREFIX . "user as user
LEFT JOIN " . TABLE_PREFIX . "usergroup as usergroup ON(user.usergroupid = usergroup.usergroupid)
WHERE lastactivity > " .$cutoff. " ORDER BY username" );
$totaltoday = 0;
while ($today = $DB_site->fetch_array($todaysusers))
{
$today[visible] = 1 ;
$totaltoday += 1;
if ($today[options] & $_USEROPTIONS[invisible])
{
$today[visible] = 0 ;
if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
{
$today[visible] = 2 ;
}
}
if ($today[visible])
{
$wrdate = vbdate($vboptions['timeformat'], $today['lastactivity']);
$whotoday .= "<a href='member.php?u=$today[userid]' title='$wrdate' >";
if ($today[visible] == 2)
{
$whotoday .= $today['opentag'].$today[username].$today['closetag']."</a>*, ";
}
else
{
$whotoday .= $today['opentag'].$today[username].$today['closetag']."</a>, ";
}
}
}
if ($whotoday)
{
$whotoday = substr($whotoday, 0, strlen($whotoday)-2);
}
?>
2: Go to the style manager. Open the style you want to edit.
In the common template section goto the phpinclude_start box and enter :
Code:
ob_start();
include('whos.online.today.php');
ob_end_clean();
3: Follow your instructions for replacing the code in the Forumhome template.
Done.
Works like a charm for me. Thanks for your work. I hope I don't offend you by posting what I did.
I would like to know since I dont play in vB a lot whether anything I did would open a security hole.
|
You may want to consider adding a conditional to your phpinclude_start template to only run that query when the page selected is forum home or your new WWOL page. As it is that code runs on every page loaded whether it's used or not. Just a little optimization suggestion.
|