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.
If anyone would like to know how this hack works, here you go.
Every time index.php is accessed, the current date (in a yyyy-mm-dd format) is generated (according to the server time, like I mentioned above).
Then the data is pulled from a special template ("memberoftheday") and the date in the template is checked against the date that was just generated.
If the dates match, then the data is ok (since it was created today, otherwise the date would be different), and nothing special needs to be done (other than assigning the data to new, easy-to-understand variables).
If the dates do not match, the current member of the day is from a different day (probably yesterday, unless no one visited your forum for more than a day ).
A new random user is selected from the database, while making sure it's not the same one that is already selected, a new data template is created and the database is updated.
The above procedure also occurs if $resetmember is set to 1 (through the URL) and the user is an admin.
So, the member of the day is only updated once a day, by the first member that visits your forum on a new day. Quite nice, no?