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.
Originally posted by Kars10 I use this hack.
Very cool. But i think i would be much better if it takes only users with min. 1 Post...
Zeroposters are not so good.
*hehe* No problems, Boofo. In fact, I've taken out the "fix" from page 9 and now have just the original code, I do believe. It seems to be working fine and hasn't had but one duplicate member in five days. But, I am still interested in the "limit it to once every thirty days" modification if you get to it. No worries.
Ok, Rose, I think I have it now. I tested it and it does not give any errors. Also, this should do the trick for the "limit it to once every thirty days" you asked for. Thanks goes out to Xenon for correcting my missing brackets mistake. Here is the code I use. You can adjust it for whatever you use. I don't have the Admins names show up and the user has to have at least one post to their credit to be picked. Let me know if it does the trick for you.
PHP Code:
$newmember=$DB_site->query_first("SELECT userid,username
FROM user
WHERE userid<>$daybits[1] AND posts>1
AND lastactivity>'.($lastposttime[dateline]-(86400*30)).'
AND (usergroupid=5
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND(NOW())
LIMIT 1");
By the way, the RAND(NOW()) just makes it more random than RAND() does. It seeds it.
Rose, you don't need to install the fix with this code I gave you. The $seed part is not necessary with the RAND(NOW()), the way I have it in the code. That takes care of the seed already. If you just install the code (no fix) the way it is and adjust the lines to who you want to include or exclude, that will be all you need to do. With the newer versions of mySQL, they need a seed or otherwise you get a randomizing that is close to the last one. The seed allows for a more random randomizing. Does that make any sense? Anyway, enjoy and let me know if the 30 days feature is working ok. And you're very welcome.
Originally posted by Boofo Rose, you don't need to install the fix with this code I gave you. The $seed part is not necessary with the RAND(NOW()), the way I have it in the code. That takes care of the seed already. If you just install the code (no fix) the way it is and adjust the lines to who you want to include or exclude, that will be all you need to do. With the newer versions of mySQL, they need a seed or otherwise you get a randomizing that is close to the last one. The seed allows for a more random randomizing. Does that make any sense? Anyway, enjoy and let me know if the 30 days feature is working ok. And you're very welcome.
Makes enough sense to go over me little head. When I said "fix", I meant I changed the chunk of code as you posted previous to mine. I don't mean I went back in the thread and installed any of the rest of it. Just your most recent update. Sorry if I mislead/misunderstood.
[high]* Rose sings "It's a small world"
[/high]
That was random. Thanks again and I'll be sure to keep an eye on it and let you know how things go. So far I've had seven MOTD's and not a single one awarded a free Sunday Brunch.