Version: 1.00, by Admin (Coder)
Developer Last Online: Nov 2024
Version: 2.2.x
Rating:
Released: 02-03-2002
Last Update: Never
Installs: 103
No support by the author.
The idea is from SitePoint Forums.
I think a lot of people really want this hack, and I've even seen a released version of it here, but it used cronjobs and stuff like that I'm sure not all of use want to mess with.
So, here's my version of the hack, completely crobjob-less and 100% working.
The hack also includes an easy way for the admins to change the member of the day at any given time. (see note below)
You can see it in action in this board, on the main page in the stats box.
To install this hack download the attached file (memberofday.hack.php), upload to your /admin folder and use vbHacker.
A couple of notes:
The member of the day will reset every day at 12:00am server time.
It is possible for the admins to re-choose the member of the day at any given time, by adding "?resetmember=1" when visiting index.php. (only logged in admins can use this; for regular users it won't do anything)
The only check in the code is to prevent the same member of the day two days in a row. It is possible, however, that the same member will be chosen two days after he was already a member of the month.
I don't recommend using this hack on a small forum (with not-so-many members) because of the above.
That's it, have fun.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
It was working before. Then I started to play with it to get it to recognise active members as the first member it picked hadn't posted in months. I did a few steps in vbhacker and screwed it.
Ran the query, no joy. I'm sure I'm missing some code. from my index.php:
PHP Code:
require('./global.php');
$permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}
//check usergroup of user to see if they can use PMs
//$permissions=getpermissions($forumid);
if ($enablepms==1 and $permissions['canusepm'] and $bbuserinfo['receivepm']) {
$ignoreusers="";
if (trim($bbuserinfo['ignorelist'])!="") {
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' ', trim($bbuserinfo['ignorelist'])));
}
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid]$ignoreusers");
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=number_format($numbersmembers['users']);
// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=number_format($countposts['posts']);
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$totalthreads=number_format($countthreads['threads']);
// get newest member
$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid=$numbersmembers[max]");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];
There's your problem. You don't have the needed code for this hack installed.
You need to replace this:
PHP Code:
$permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}
with this:
PHP Code:
$permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}
// start member of the day stuff
$thisdate=date('Y-m-d');
$getdaytemplate=$DB_site->query_first("SELECT template
FROM template
WHERE title='memberoftheday'
AND templatesetid=-2");
$daytemplate=$getdaytemplate['template'];
$daybits=explode('||vb||',$daytemplate);
if ($daybits[0]!=$thisdate or ($resetmember==1 and $bbuserinfo['usergroupid']==6)) {
/* This template is either outdated or the admin wants to reset it.
Either way, we need to choose a new member of the day. Aren't you excited?! */
$newmember=$DB_site->query_first("SELECT userid,username
FROM user
WHERE userid<>$daybits[1] AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1");
$newtemplate=$thisdate.'||vb||'.$newmember['userid'].'||vb||'.$newmember['username'];
$DB_site->query("UPDATE template
SET template='".addslashes($newtemplate)."'
WHERE templatesetid=-2
AND title='memberoftheday'");
$memberoftheday['userid']=$newmember['userid'];
$memberoftheday['username']=$newmember['username'];
} else {
$memberoftheday['userid']=$daybits[1];
$memberoftheday['username']=$daybits[2];
}
// end of member of the day stuff
Yea, it works! One down about 5 to go. On to the stats panel now. Thanks man, your help has been really appreciated. Any more ideas on the quick reply box? I PMed ya....
I PMd you the fix for that earlier. You had your showthtread.php code in the showthread_replybox template. Delete that code and put in the code I PMd you for the showthread_replybox, upload the showthread.php I fixed for you and it will work.
Quote:
Originally posted by NexDog Yea, it works! One down about 5 to go. On to the stats panel now. Thanks man, your help has been really appreciated. Any more ideas on the quick reply box? I PMed ya....