View Full Version : Member of the Day!
Admin
02-03-2002, 10:00 PM
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. :D
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 (https://vborg.vbsupport.ru/showthread.php?s=&threadid=36378).
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. :D
Admin
02-04-2002, 04:32 PM
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? :)
Lesane
02-04-2002, 04:54 PM
Very nice, well done. :up:
Great hack! Thanks mate :D
Bald Bouncer
02-04-2002, 05:45 PM
very good! easy install and worked a charm!!
Awesome Chen, I'll put this up on my forums when I get a few more members! :)
afterlab
02-04-2002, 08:54 PM
Nice hack, I'm using it on my Forums. :D
Lionel
02-04-2002, 08:58 PM
I just installed and my first member of the day is someone who has not visited yet...
Freddie Bingham
02-04-2002, 09:40 PM
Sounds suspiciously like how birthdays work ;)
Psychdrone
02-04-2002, 11:34 PM
another wonderful release!
DarkReaper
02-04-2002, 11:43 PM
Cool :)
Psychdrone
02-05-2002, 12:44 AM
actually, I have a question, I can not find
$permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}
IN my index.php? I am running 2.2.1, is there a difference?
what line is it on thanks!
SaintDog
02-05-2002, 01:29 AM
Once I get things set back up, I am going to be using this, great job on yet another hack FireFly.
squawell
02-05-2002, 02:46 AM
great job FireFly~~
i'll be use it~:D:D:D:D
igowoofwoof
02-05-2002, 04:48 AM
how do i intergrate this with the hack
[RELEASE newsfader for all vb version.(11* to 2.0*)]
Admin
02-05-2002, 07:10 AM
Originally posted by freddie
Sounds suspiciously like how birthdays work ;)
Hrrrm hmphh... ;)
MarkB
02-05-2002, 07:43 AM
Nice! Installed :D
illogicalx
02-05-2002, 08:28 AM
Chen
it's a nice hack :)
i was thinking about it :(
"member of the month "
next time i have to work faster then now :D
thanks :)
Floris
02-05-2002, 10:42 AM
About 5 members here said they installed it, I visited their site, but couldn't see the hack installed..guys: where can I find an installed version? ..
Sounds like a great hack :)
Psychdrone
02-05-2002, 10:55 PM
Originally posted by Psychdrone
actually, I have a question, I can not find
$permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}
IN my index.php? I am running 2.2.1, is there a difference?
what line is it on thanks!
somebody?
Admin
02-06-2002, 06:41 AM
Add the hack after require('./global.php');
ckevin
02-06-2002, 11:38 AM
that's a great hack, but i think it would be much more better if we limit only members have to post say, 100 posts before he can enter to the member of the day automatically, how can we do that? =)
Admin
02-06-2002, 12:02 PM
Sure ckevin, just replace this in the code:
WHERE userid<>$daybits[1]
with this:
WHERE userid<>$daybits[1] AND posts>99
ckevin
02-06-2002, 12:26 PM
wonderful, FireFly! :D
Thanks,
Kevin
DarkReaper
02-06-2002, 07:10 PM
What about having activity recently...say, the active within the past 2 weeks?
Admin
02-07-2002, 11:43 AM
Huh? You mean only to select members that were active in the last 2 weeks?
DarkReaper
02-07-2002, 03:36 PM
Yes...that way it won't have a MoTD that hasn't been to the forums in 6 months :)
Admin
02-07-2002, 03:42 PM
Replace:
WHERE userid<>$daybits[1]
with:
WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
(14 is the number of days)
By the way, I'm not sure myself whether it's lastactivity or lastvisit we need to check, so I'm open for corrections here. :)
importmix
02-08-2002, 06:03 AM
Works. Thumbs up.
Lucky
02-08-2002, 09:35 AM
Great work my friend!
Dark_Wizard
02-09-2002, 11:25 AM
Originally posted by illogicalx
Chen
it's a nice hack :)
i was thinking about it :(
"member of the month "
next time i have to work faster then now :D
thanks :)
Nice hack...I would like to see member of the month as well.
Psychdrone
02-10-2002, 04:49 AM
how would you make this user of the week?
Tech_Koss
02-10-2002, 06:00 AM
Originally posted by xiphoid
About 5 members here said they installed it, I visited their site, but couldn't see the hack installed..guys: where can I find an installed version? ..
Sounds like a great hack :)
yea I couldnt find it either :confused:
where is it on the forum?
Nice!
I was going to do something like this and I like the way you handled it. It's exactly how I handled it for my ubb homepage except you've taken advantage of the templates table, which I love.
Used it to store random member id and random link id of the day and calling them to my homepage instead of the forum homepage.
Featured link is already working. need to make a tiny profile summary box for the featured member.
Will probably expand this for of features of the day like random trivia question of the day. I'll just add 2 more fields with todays trivia id and yesterdays trivia id. that way I can have todays question and the answer to yesterdays. (before you ask about the trivia. it's not a real hack. just added a table with 3 fields, id, question, & answer. then just grabbing the text. No admin form to edit them or anything. just phpmyadmin for now.)
thanks again, it will get used alot.
PS - was trying to think of a nice way to make it member of the week instead of day. I mean I know I could change it every 7 days, but it seems like I'd eventally knock it off by reseting it in the middle of the week or something. plus you'd need a check for end of the month / end of the year. anybody got a nice idea?
the easy answer would be to just make it feature of the month bu that would be too long of a time period.
Admin
02-10-2002, 12:42 PM
It's possible to make this member of the week, just use the date() function (http://www.us2.php.net/manual/en/function.date.php) with W as the format... unless your forum won't be visited for a year (;)) you should be fine.
Dark_Wizard
02-10-2002, 01:34 PM
Originally posted by FireFly
It's possible to make this member of the week, just use the date() function (http://www.us2.php.net/manual/en/function.date.php) with W as the format... unless your forum won't be visited for a year (;)) you should be fine.
LOL...
Wayne Luke
02-10-2002, 03:12 PM
Originally posted by xiphoid
About 5 members here said they installed it, I visited their site, but couldn't see the hack installed..guys: where can I find an installed version? ..
Sounds like a great hack :)
www.sitepointforums.com
Though I am still using my original design and it uses a cronjob and doesn't store it in the text file. Though if I wanted to I could use my Member of the Day anywhere and it could automatically generate MOTD, MOTW, MOTM, and MOTY in one run. Also it isn't tied into any user accessing the forum so it happens when I want it to.
Psychdrone
02-10-2002, 04:20 PM
Originally posted by FireFly
It's possible to make this member of the week, just use the date() function (http://www.us2.php.net/manual/en/function.date.php) with W as the format... unless your forum won't be visited for a year (;)) you should be fine.
I sure hope so :p althu it might be close
and hey about the memeber of the week thing, I am a little confused (beging to leran php) would I change it to something like this date('Y-m-W') ??
thanks for the help
Admin
02-10-2002, 04:58 PM
No, change it to date('W') only, and also only store that number (should give you a number from 1-52). Then compare the number in the template with the number you just got from the date() call.
If you want I can post the modified code here, but you should give it a try, it's not very hard. :)
cditty
02-10-2002, 09:29 PM
Apparently, I have done something wrong. I keep getting an SQL error. It seems to be on the "Order by RAND()" line.
I did the insert with no problems. Added the hack below the correct section and now index.php crashes. Even tried the reset for member of the day and it still crashed.
Any ideas?
Chris
Psychdrone
02-10-2002, 10:19 PM
Originally posted by FireFly
........If you want I can post the modified code here,.........
and thats why you are so cool :p , thanks for giving me a chance to figure it out on my own, I looked at it for about 10 menites but couldn't figure it out:(
But I am learning my friend, jsut at a slow pace (lots of other stuff going on in life) I shall amaze you one day:)
cditty
02-10-2002, 11:11 PM
It looks like the Order by RAND() function is not available for mysql versions 3.22 or lower. Any way of getting the sql rewritten to work with 3.22? :)
Thanks
Chris
Admin
02-11-2002, 09:04 AM
What version is your MySQL? I know that the ability to order by RAND() was only added in a certain version... I'll dig up see if I can find the older way to get a random row. :)
cditty
02-11-2002, 01:46 PM
I'm running 3.22.32. I looked and the order by rand() does only seem to be available to 3.23 and up.
I am trying to talk myself into upgrading the mysql version, but I'm chicken.
Admin
02-11-2002, 04:29 PM
Ok my book tells me you should change the query to this:
$newmember=$DB_site->query_first("SELECT userid,username,userid*0+RAND() AS randNum
FROM user
WHERE userid<>$daybits[1]
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY randNum
LIMIT 1");
cditty
02-11-2002, 06:04 PM
Works like a champ. Thanks.
Chris
Psychdrone
02-11-2002, 11:35 PM
firefly?
Admin
02-12-2002, 09:56 AM
Right, sorry. :)
Just change first line of code to this:
$thisdate=date('W');
And I think you're done.
thanks gonna try this 1 out :)
Massiel
02-14-2002, 01:07 AM
How do you run a query? I am new at this, you lost me hehe
Sharp
02-15-2002, 03:55 AM
Yes, how do you run a query? :?:
Double bump this. :)
cditty
02-18-2002, 05:50 PM
Firefly, any way to put a little graphic or something on the MOTD user's post for the day? Something like the birthday hack.
ps...my users really like this. thanks.
Chris
Hamma
02-18-2002, 07:30 PM
Originally posted by FireFly
Replace:
WHERE userid<>$daybits[1]
with:
WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
(14 is the number of days)
By the way, I'm not sure myself whether it's lastactivity or lastvisit we need to check, so I'm open for corrections here. :)
When I do this, ?resetmember=1 does not work anymore, which makes me wonder what it will do at midnight
WreckRman2
02-19-2002, 02:51 AM
I installed this but it shows the same member everyday unless I do the reset thing myself. In other words it's not selecting a new member on it's own each day. Any ideas why?
DiSS Troya
02-20-2002, 08:43 AM
Nevermind, I fixed my problem.
cditty
02-23-2002, 10:25 PM
****bump****
Floris
02-24-2002, 11:55 AM
Waaaaaay cool.
I just applied 'Who was online today' hack and merged that with the WOL box, I had one blank line left, and this just fit in perfectly! Fnx ;)
WreckRman2
02-24-2002, 03:24 PM
Originally posted by WreckRman2
I installed this but it shows the same member everyday unless I do the reset thing myself. In other words it's not selecting a new member on it's own each day. Any ideas why?
I've ran this for about a week now and it's never changed the member of the day. Any reason why it isn't automatically changing daily?
Admin
02-24-2002, 03:58 PM
What version of MySQL are you using?
ForKmaN
02-24-2002, 09:52 PM
I get this:
Database error in vBulletin 2.2.1:
Invalid SQL: SELECT userid,username
FROM user
WHERE userid<>
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1
mysql error: You have an error in your SQL syntax near 'AND (usergroupid=5
OR usergroupid=6
' at line 4
mysql error number: 1064
Date: Sunday 24th of February 2002 03:53:22 PM
Script: http://www.gb-mod.net/forums/forums/index.php?
Referer: http://www.gb-mod.net/forums/admin/index.php?action=head
And how Do I query that first line?
cditty
02-25-2002, 02:09 AM
By chance did you try the query that FireFly gave me?
$newmember=$DB_site->query_first("SELECT userid,username,userid*0+RAND() AS randNum
FROM user
WHERE userid<>$daybits[1]
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY randNum
LIMIT 1");
FireFly, any thoughts about my last question? ie....use an image on the MOTD's posts. Something like the birthday hack?
Chris
ForKmaN
02-27-2002, 03:09 AM
I would try but how do i run a query?
cditty
02-27-2002, 02:02 PM
Check out this thread - http://www.vbulletin.com/forum/showthread.php?threadid=18558
Chris
wvvwnet
02-27-2002, 11:55 PM
DO you have an example of forum has this hacks work on?
Admin
02-28-2002, 10:05 AM
This forum.
streamzone
03-03-2002, 12:59 AM
sounds like a cool hack. i ran the db queery and modified the index.php then added the code to forumhome template...but i do not see member of the day :(
verion 2.2.2.
any idea's on what i should try fellas?
Thanx
streamzone
03-03-2002, 01:04 AM
umm...DUH!! i swear my own eyes deceive me sometimes. i got it working by following the very easy directions and its working great. thanx again for another cool hack guys.
Originally posted by ForKmaN
I get this:
Database error in vBulletin 2.2.1:
Invalid SQL: SELECT userid,username
FROM user
WHERE userid<>
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1
mysql error: You have an error in your SQL syntax near 'AND (usergroupid=5
OR usergroupid=6
' at line 4
mysql error number: 1064
Date: Sunday 24th of February 2002 03:53:22 PM
Script: http://www.gb-mod.net/forums/forums/index.php?
Referer: http://www.gb-mod.net/forums/admin/index.php?action=head
And how Do I query that first line?
This is exactly what I am getting... it is not a random problem like you were having cditty. Any ideas anyone?
cditty
03-03-2002, 09:47 PM
Originally posted by FireFly
Replace:
WHERE userid<>$daybits[1]
with:
WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
(14 is the number of days)
By the way, I'm not sure myself whether it's lastactivity or lastvisit we need to check, so I'm open for corrections here. :)
Chen, any idea on how to get the time feature to work with that mysql you gave me? I played with it a bit and couldn't figure it out.
Thanks
Chris
Admin
03-04-2002, 11:37 AM
What went wrong cditty?
ForKmaN and neal, run the query I gave in the hack instructions.
cditty
03-04-2002, 02:34 PM
I don't know. It's weird. I figured it musta had something to do with the customized sql that you had to give me. Every time I tried it, I got an invalid sql command.
I also just sent you a pm....
Chris
I have done so, and I still get the error
ForKmaN
03-05-2002, 02:25 PM
works for me now :)
cditty
03-07-2002, 01:42 AM
Any ideas on mine FireFly?
Chris
Admin
03-07-2002, 08:55 AM
What's the error you are gettting, Chris?
cditty
03-07-2002, 10:50 AM
This is the error that I am getting.
Database error in vBulletin 2.2.1:
Invalid SQL: -1209600
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=9
OR usergroupid=10
OR usergroupid=2)
ORDER BY randNum
LIMIT 1
mysql error:
mysql error number:
Date: Thursday 07th of March 2002 06:46:03 AM
[\code]
This is the code as I have it in my index.php3 file.
[code]
$newmember=$DB_site->query_first("SELECT userid,username,userid*0+RAND() AS randNum
FROM user
WHERE userid<>$daybits[1] AND posts>99
AND lastactivity>time()-(86400*14)
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=9
OR usergroupid=10
OR usergroupid=2)
ORDER BY randNum
LIMIT 1");
I have tried it with and without the "s around the time() section. Wierd thing is that I can run this query though mysqladmin.
Chris
cditty
03-07-2002, 10:59 AM
I just got it going. I simply replaced the "s with 's. Seems to work like a charm.
Thanks again.
Chris
Dakota
03-12-2002, 03:31 PM
Thanks, my members love this hack, just need to change it so that the use must still be active on the forum.
Dakota
03-13-2002, 10:07 PM
Originally posted by FireFly
Replace:
WHERE userid<>$daybits[1]
with:
WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
(14 is the number of days)
By the way, I'm not sure myself whether it's lastactivity or lastvisit we need to check, so I'm open for corrections here. :)
when I changed it to go by the activity, it gave me an error. I don't know why, I copied everything correctly.
cditty
03-13-2002, 10:54 PM
try using single quotes instead of double. That was my problem.
Chris
Vivi Ornitier
03-13-2002, 11:27 PM
can we make it so when a user is the member of da day, he'll get an email saying he's the member of the day . .yadda ydda yadda?
Admin
03-14-2002, 10:06 AM
Put
time()-(86400*14)
around parenthesis, like this:
WHERE userid<>$daybits[1] AND lastactivity>".(time()-(86400*14))."
:)
Mathiau
03-17-2002, 01:19 AM
Mever mind, saw above link, :
how do i run a query :(...
Mathiau
03-26-2002, 06:34 AM
Originally posted by e_dove
how do i run a query :(...
read above post by cditty:
Check out this thread - http://www.vbulletin.com/forum/show...?threadid=18558
Chris
Admin
03-26-2002, 06:54 AM
Just uploaded a vbHacker version to the first post. :)
GeOrGe
03-26-2002, 03:14 PM
Originally posted by squawell
great job FireFly~~
i'll be use it~:D:D:D:D
I use it too, but why does it say nothing?
Look: http://chatter-board.de
Admin
03-26-2002, 03:15 PM
Did you run the query you were told to run?
GeOrGe
03-26-2002, 03:16 PM
Originally posted by GeOrGe
I use it too, but why does it say nothing?
Look: http://chatter-board.de
Mein Englisch ist nicht das beste, deswegen versuche ich das nun Deutsch, aber hoffe auf antwort.
Ich brauch den Hack, dass meine Zitate und so auch in diesem K?stchen erscheinen, wo bekomm ich den her, kann mir da einer von euch helfen?
GeOrGe
03-26-2002, 03:16 PM
Originally posted by FireFly
Did you run the query you were told to run?
So I think so
xtrim
04-17-2002, 05:16 AM
Firefly,
thnx for the hack, i find it great and would like to request what I think won't be very tough modification.
How could I add diplaying the avatar the member of the day has?
Thanks again!
diettalk
04-17-2002, 01:26 PM
I had this type of a hack when I used UBB but haven't used it with vBulletin because all the "members of the day" where people who didn't come to the forums anymore or it picked someone with 0 posts. ;)
How about adding a feature to make sure the member of the day is someone who actually is a participating member. Someone who has logged in within the past month or 2. vBulletin already keeps the "last visit".
Admin
04-17-2002, 04:25 PM
Reading through the thread usually helps, diettalk. :rolleyes:
KuraFire
05-01-2002, 09:17 AM
Great hack, just installed it using vbHacker :):up:
ceo_tfw
05-06-2002, 08:26 PM
is there a text version of the (Members of the Day so that I can do this manually, I prefer this as I can backtrack my mistakes, if any, I am on version 2.2.5
can anyone help please
Smalley
05-07-2002, 02:25 AM
can we have the 2.2.5 version soon ..
Danny
05-19-2002, 06:43 PM
is there anyway to make the member of the day clickable?
ULTIMATESSJ
05-19-2002, 06:58 PM
Originally posted by ceo_tfw
is there a text version of the (Members of the Day so that I can do this manually, I prefer this as I can backtrack my mistakes, if any, I am on version 2.2.5
can anyone help please
if you go into vbhacker ou should be able to generate a txt file with all the instructions
Velocd
05-19-2002, 07:51 PM
I haven't read through the posts in here yet, but is there a way to make it choose a random user through all those who have posted recently, say, in the last week. I just don't want it to choose a user who hasn't posted in 1 month or something.
Roxie
05-22-2002, 11:11 AM
Does this work with 2.2.5?
Thanks
Admin
05-22-2002, 11:17 AM
Yes it does.
missorator
05-30-2002, 01:07 PM
Chen, this is a great hack. However, it isn't working too well at my forums (it's not the hack - it's nothing to do with vb actually ;)). How can I safely remove it?
Sorry for sounding dumb...I haven't ever removed a hack before ;)
Thanks!
Jen
Admin
05-30-2002, 02:32 PM
Just do everything the instructions say, only backwords. Don't mind the query you ran, there's no need to remove what it added (trust me).
Kars10
06-11-2002, 10:56 AM
Great Hack FireFly!!!
Very Easy to install!! :D
Thanx so much..
Velocd
06-19-2002, 05:16 AM
So how about post #99? Think it can be done?
Admin
06-19-2002, 09:10 AM
Already done, read through the thread.
Hi, need a little help.
I got all the way to the last step.
It says:
?Run this query: |
+-----------------------------------------------------------------------+
INSERT INTO template (templateid,templatesetid,title,template) VALUES (NULL,-2,'memberoftheday','0||vb||0||vb||0');"
How do I do this? What does it mean when Im told to "run a query"? Thanks for your help.
Thewnagchung
07-31-2002, 05:19 AM
Originally posted by Knightmare
Hi, need a little help.
I got all the way to the last step.
It says:
?Run this query: |
+-----------------------------------------------------------------------+
INSERT INTO template (templateid,templatesetid,title,template) VALUES (NULL,-2,'memberoftheday','0||vb||0||vb||0');"
How do I do this? What does it mean when Im told to "run a query"? Thanks for your help.
it means run a query on your mySQL database, it will add that table to your database.
do this in phpmyadmin
BUT BACK UP YOUR DATABASE FIRST!!
Originally posted by Thewnagchung
it means run a query on your mySQL database, it will add that table to your database.
do this in phpmyadmin
BUT BACK UP YOUR DATABASE FIRST!!
Thanks for the reply.
Sorry, Im a newbie at this, but how do I access phpmyadmin?
Thanks again.
Thewnagchung
07-31-2002, 05:50 AM
Originally posted by Knightmare
Thanks for the reply.
Sorry, Im a newbie at this, but how do I access phpmyadmin?
Thanks again.
well im not sure if your server has it installed, but if it does you should be able to acess it via your site cpanel
Ok, thanks for the help:)
Thewnagchung
07-31-2002, 06:15 AM
Originally posted by Knightmare
Ok, thanks for the help:)
no problemo el muchacho ^^
NexDog
08-09-2002, 12:21 AM
Can I just run the whole the whole query again to get the users who are active to show? Looks like it would be easiest in phpmyadmin. Can someone paste in the whole query with that edit that was post by FireFly? I'm no mysql expert, can't even tell where the query ends. :D
NexDog
08-09-2002, 12:28 AM
Okay, it isn't the query that needs to be changed, just the code. duh.
Anyhow, I just need people active in the last month to qualify. What timestamp can I use in this code:
WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
Admin
08-09-2002, 07:34 AM
Change 14 to 30 (number of days).
NexDog
08-09-2002, 08:51 AM
Yea, but instead of "time", don't I need php code?
Boofo
08-09-2002, 09:39 AM
Just change it to what Firefly said and it will work the way you want it to. He's done this once or twice before, I think. :)
Originally posted by NexDog
Yea, but instead of "time", don't I need php code?
NexDog
08-09-2002, 11:33 AM
Okay...but have some weirdness happening. No name is appearing:
http://www.hostnexus.com/forum/index.php?s=
Under the stats at the top. I just want this working so I can install the main Stats hack.
And Christ. Will some tell me how to get the user online/offline thing happening like it is here? :D
Boofo
08-09-2002, 12:02 PM
Are you using this line? I just looked at your code and didn't see it. ;)
<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$memberoftheday[userid]"><b>$memberoftheday[username]</b></a>
Originally posted by NexDog
Okay...but have some weirdness happening. No name is appearing:
http://www.hostnexus.com/forum/index.php?s=
Under the stats at the top. I just want this working so I can install the main Stats hack.
And Christ. Will some tell me how to get the user online/offline thing happening like it is here? :D
NexDog
08-09-2002, 01:48 PM
Yep:
<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid">$newusername</a>";i:13;s:253:"<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid">$newusername</a><br>
The $bbtitle member of the day is <a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$memberoftheday[userid]">$memberoftheday[username]</a>
NexDog
08-09-2002, 01:52 PM
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.
Boofo
08-09-2002, 02:13 PM
Did you run the needed query in the database and insert the code into the index.php?
NexDog
08-09-2002, 02:20 PM
I think I screwed the query by running it again or something
If someone could give me the pure query, I'll run it again in phpmyadmin.
Boofo
08-09-2002, 02:22 PM
INSERT INTO template (templateid,templatesetid,title,template) VALUES (NULL,-2,'memberoftheday','0||vb||0||vb||0');
NexDog
08-09-2002, 02:34 PM
Ran the query, no joy. I'm sure I'm missing some code. from my index.php:
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");
if ($newpm['messages']==0) {
$lightbulb='off';
} else {
$lightbulb='on';
}
eval("\$pminfo = \"".gettemplate('forumhome_pmloggedin')."\";");
} else {
$pminfo='';
}
$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'];
Boofo
08-09-2002, 02:41 PM
There's your problem. You don't have the needed code for this hack installed.
You need to replace this:
$permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}
with this:
$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
NexDog
08-10-2002, 07:20 AM
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....
Boofo
08-10-2002, 07:42 AM
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.
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....
proxyMX
08-11-2002, 01:37 PM
cant use this, i used Vbindex,
NexDog
08-12-2002, 11:21 AM
Boofo, didn't get that PM for some obscure reason. If you could, please send again as I'm killing myself over this....
TIA
NexDog
08-13-2002, 06:28 AM
I tried to change the wording on the Member of the day to Member of the Moment (because it seems to picking a new member whenever it wants, lol).
I changed it to:
// end of member of the day stuff";i:11;s:9:"forumhome";i:12;s:94:"<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid">$newusername</a>";i:13;s:253:"<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid">$newusername</a><br>
The HN Forums Member of the Moment is <a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$memberoftheday[userid]">$memberoftheday[username]</a>";i:14;s:114:"INSERT INTO template (templateid,templatesetid,title,template) VALUES (NULL,-2,'memberoftheday','0||vb||0||vb||0')";}
And uploaded it. But it didn't change on the index page as you can see........
Boofo
08-13-2002, 07:30 AM
For the Quick Reply Box, You have mixed up the code for the showthread.php and the code for the showthread_replybox template. Start over and take what you have out of the showthread_replybox and put in the right code for it and then upload the showthtread.php that I fixed for you and it should work fine.
NexDog
08-13-2002, 08:43 AM
That's just the problem. Firefly's instruction's said:
2. Create a new template, with the name "showthread_replybox": // ##################################################
And that was it! Nothing else as next was the info about number 3 which involved $pagenav. What am I missing?
Sorry to be a pain. :(
Boofo
08-13-2002, 09:18 AM
Clear your cache and re-download the instructions in the first post of that thread. It is all there. I checked it.
NexDog
08-13-2002, 10:00 AM
Dude, I ain't tripping. Look at what I'm seeing. There are no instructions other than to create the template itself. Then there's an image of the box. Is the html transforming into an image especially for me?
Boofo
08-13-2002, 10:20 AM
What are you viewing that in?
NexDog
08-13-2002, 11:25 AM
I'm not viewing it in anything. I'm just hitting FireFly's .txt link in his first post and that's what I get. And it isn't just FireFly's either. I'm getting on a few others/
Tell me I'm not crazy! I'm new to hacking vB but not to php and the concept of hacking in general. ;)
NexDog
08-14-2002, 03:08 AM
Shameless bump. I know I'm asking about this in the wrong thread but that's just the way it turned out. :)
Boofo
08-14-2002, 03:21 AM
Just download the text file and follow the instructions in it and you can't go wrong.
Originally posted by NexDog
Shameless bump. I know I'm asking about this in the wrong thread but that's just the way it turned out. :)
NexDog
08-15-2002, 05:24 AM
Okay, got that working after someone showed me what FireFly's text doc really looks like. Have no idea why I can't see these files properly.
Also got this hack working the way I want too.
Install has been clicked. :)
Now to find that active users today hack, wher the hell was that.......
NexDog
08-15-2002, 05:49 AM
Double post. :tired:
NexDog
08-16-2002, 06:38 AM
Originally posted by FireFly
Replace:
WHERE userid<>$daybits[1]
with:
WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
(14 is the number of days)
By the way, I'm not sure myself whether it's lastactivity or lastvisit we need to check, so I'm open for corrections here. :)
Well, that produced this:
Database error in vBulletin 2.2.6:
Invalid SQL: -1209600
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1
mysql error: You have an error in your SQL syntax near '-1209600
AND (usergroupid=5
' at line 1
mysql error number: 1064
Date: Friday 16th of August 2002 05:47:34 AM
Script: http://www.hostnexus.com/forum/forum/
Referer:
So I just used the minimum posts requirement instead of last activity....
Boofo
08-16-2002, 06:42 AM
Did you try lastvisit?
Originally posted by NexDog
Well, that produced this:
Database error in vBulletin 2.2.6:
Invalid SQL: -1209600
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1
mysql error: You have an error in your SQL syntax near '-1209600
AND (usergroupid=5
' at line 1
mysql error number: 1064
Date: Friday 16th of August 2002 05:47:34 AM
Script: http://www.hostnexus.com/forum/forum/
Referer:
So I just used the minimum posts requirement instead of last activity....
NexDog
08-16-2002, 06:44 AM
Not a happy chappie though. ;)
Hack still rocks Chen. To chose an active member from the last 14 days is much better. What is wrong with the syntax in this statement:
WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
???
Boofo
08-16-2002, 06:47 AM
Try this and let me know what happens:
WHERE userid<>$daybits[1] AND lastvisit>".time()-(86400*14)."
Originally posted by NexDog
Not a happy chappie though. ;)
Hack still rocks Chen. To chose an active member from the last 14 days is much better. What is wrong with the syntax in this statement:
WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
???
NexDog
08-16-2002, 07:08 AM
You mean:
WHERE userid<>$daybits[1] AND lastvisit>".time()-(86400*14)."
I'm not to keen as it took a while to identify the problem.....
NexDog
08-16-2002, 07:10 AM
Ooops, didn't see that post, dude. You want to try it?
Boofo
08-16-2002, 07:11 AM
Yes. Did you try it yet? :)
Originally posted by NexDog
You mean:
WHERE userid<>$daybits[1] AND lastvisit>".time()-(86400*14)."
I'm not to keen as it took a while to identify the problem.....
NexDog
08-16-2002, 07:15 AM
You won't know until the a new day and a visitor triggers the MOTD query. That's 18 hours for me.
Boofo
08-16-2002, 07:20 AM
But did you get an error with that like you did with the other code?
Originally posted by NexDog
You won't know until the a new day and a visitor triggers the MOTD query. That's 18 hours for me.
NexDog
08-16-2002, 07:24 AM
No errors on FireFly's original code. I won't know if this will bomb until the next day......
NexDog
08-19-2002, 06:16 AM
Help!
I used:
WHERE userid<>$daybits[1] AND posts>99
And the same member has been selected 2 days out of 3!!!
Is there a fix?
NexDog
08-22-2002, 01:52 PM
When using:
WHERE userid<>$daybits[1] AND lastvisit>".time()-(86400*14)."
I get:
Fatal error: Call to undefined function: phperror_reporting() in /var/www/vhosts/hostnexus.com/httpdocs/forum/index.php on line 1
a43079
09-21-2002, 10:18 AM
does this work with 2.2.7
DarkDraco07
10-16-2002, 05:19 AM
problem on newer forums i think. when i enter the query into my database it doesnt save. like, usually if i enter a query twice it says that there is a duplicate column but not for the query here. when i have the hack installed i get an sql error because of this. it there an alternative query to run?
DarkDraco07
10-27-2002, 04:15 PM
can anyone help?
javogevp
11-23-2002, 02:50 AM
hey dude!
do u know if this hack may be modified for giving some credits for "the LesaneĀ“s Store Hack". But if the guy dosnt log in i that day where he was selected for the member of the day he dost win ay money???
please help, i dunno much about programing
PsyBlast
12-15-2002, 09:01 PM
whenever I upload the file to the admin folder and run vbhacker.php it doesnt come up, I have refreshed it about 20 times, I have the newest version of vbhacker also.
Mike Gaidin
01-25-2003, 04:08 AM
I installed this but it only shows the same two people every other day. I used the text file provided by vbhacker to install it. Are there known issues with this?
Mike Gaidin
01-25-2003, 04:08 AM
I installed this but it only shows the same two people every other day. I used the text file provided by vbhacker to install it. Are there known issues with this?
SouledOut
02-15-2003, 09:45 PM
ok, now I'm running into some problems, lol. I don't have the MySQL access to the directory, so it's a coding problem (vBHacker added the query correctly, I wish all hacks where like this) anyway, it tells me it can't find $permissions=getpermissions();
if (!$permissions['canview']) {
show_nopermission();
}
yet its on line 10 of index.php on vb2.2.8. I chose not to modify templates, because they use a modded design, and layout wise it belongs in the header. Anyway, I've done everything I'm supposed to, but vBHacker still won't reconize the changes! I found the only instance of the code, and added the code after ('require global.php') and no, the varible part isn't there twice. I just either A) want to get this thing working, or B) get vBHacker to work right. I'll try deleting the .hack.php file to get vBhacker to work again, and add the template manually and see what happens. Since everything is // ed out, I don't think it'll effect index.php.
mheinemann
02-18-2003, 01:52 PM
Originally posted by J-OST
I installed this but it only shows the same two people every other day. I used the text file provided by vbhacker to install it. Are there known issues with this?
I've been having this problem recently, didn't use to do it though.
mheinemann
02-19-2003, 09:07 PM
I think I found a fix if you're having this problem
find if ($daybits[0]!=$thisdate or ($resetmember==1 and $bbuserinfo['usergroupid']==6)) {
below that put $seed = rand();
then find $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");
replace with $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($seed)
LIMIT 1");
Mike Gaidin
02-19-2003, 10:49 PM
I'll try that! Thanks!
mheinemann
02-19-2003, 10:57 PM
Let me know if it works for you.
Mike Gaidin
02-19-2003, 11:30 PM
Ok, will do. It might take a few days to make sure it's not going to use the same two names.
Boofo
02-19-2003, 11:36 PM
Originally posted by mheinemann
I think I found a fix if you're having this problem
Just changing RAND() to RAND(NOW()) will do the same thing with less code and you don't have to do the $seed= part of it. That's what NOW does automatically. :)
suzannev
02-19-2003, 11:42 PM
Has anyone figured out how to allow for the member of the day's avatar to show and/or a link to their profile?
Thanks.
Boofo
02-20-2003, 12:53 AM
This hack provides a link to their profile. :)
+-------------------------------------------------------------------------------------------------+
| In the "forumhome" template, replace this code: |
+-------------------------------------------------------------------------------------------------+
<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid">$newusername</a>
+-------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------+
| With this code: |
+-------------------------------------------------------------------------------------------------+
<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid">$newusername</a><br>
The $bbtitle member of the day is <a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$memberoftheday[userid]">$memberoftheday[username]</a>
+-------------------------------------------------------------------------------------------------+
Originally posted by suzannev
Has anyone figured out how to allow for the member of the day's avatar to show and/or a link to their profile?
Thanks.
suzannev
02-20-2003, 01:52 PM
I am very new to this hacking thing, but I spent some time trying to do this myself, and I shocked myself! I added this to the boardstat.php hack so I could put it on a non-vb page. I hope I do not confuse anyone, but here is what I did and a screen shot. I am very pleased with the results.
in the boardstat.php file I added this to the end of the "member of the day stuff":
if ($memberoftheday[userid]!=0) {
$avatarurl2=getavatarurl($memberoftheday[userid]);
if ($avatarurl2=='') {
$avatarurl2='images/avatars/noavatar.gif' ;
}
$avatarimage2='<img src="http://www.cacfriends.com/shareacard/forums/upload/ '.$avatarurl2.'" border="0" height=38>';
}
And at the bottom of the page just before the ?> I placed this (right HTML output):
</td>
<td width=40% align=right>
<font size=1 face=verdana>Newest member <a href=\"http://www.cacfriends.com/shareacard/forums/upload /member.php?s=&action=getinfo&userid=$newuserid\">$newusername</a><br>
<font size=1 face=verdana>Member of the day is: <font color=yellow><b>$memberoftheday[username]</font></b><br>
<font size=2 face=verdana><b><a href=\"http://www.cacfriends.com/shareacard/forums/upload /member.php?s=&action=getinfo&userid=$memberoftheday[userid]\">$avatarimage2</b></a><br></td></table>";
WITH THE BLUE ITEMS NEEDING TO BE CHANGED TO YOUR SITE SPECS
Everything is working just fine, here is a link to the testpage I have it on:
My test page (http://www.cacfriends.com/forumtest.shtml)
and a screen shot too. I hope I didn't screw anyting else up, I guess time will tell. This is more fun then I thought :D
Boofo
02-20-2003, 01:59 PM
Good job! Looks great!
BTW, what is the "boardstat.php hack"? I must have missed that one. :)
suzannev
02-20-2003, 02:07 PM
Here is the link:
Boardstat link (https://vborg.vbsupport.ru/showthread.php?s=&threadid=43454)
Your signature sounds like me at the mall with my kids, I tell my 2 sons (13 and 10) not to walk with me, I don't want anyone to think I am that old. :eek:
Boofo
02-20-2003, 02:20 PM
Thank you for the link. ;)
Congratulations on surviving teenagers. :) I have a 5 year old and 3 months old twins (all boys) and 2 grown boys (21 and 22) and I'm not sure I'll survive it all. I think that's why I adopted the signature. :) (But I wouldn't trade any of them for the world).
mheinemann
02-21-2003, 07:40 PM
Originally posted by Boofo
Just changing RAND() to RAND(NOW()) will do the same thing with less code and you don't have to do the $seed= part of it. That's what NOW does automatically. :)
Thanks for the tip. :)
Mike Gaidin
02-21-2003, 07:50 PM
Originally posted by mheinemann
Let me know if it works for you.
Looks like it works fine. Thanks for the help. :)
Boofo
02-21-2003, 08:05 PM
Originally posted by mheinemann
Thanks for the tip. :)
You're very welcome. ;) I found this tip at the mysql site and it seems to make a difference.
:) Thanks Firefly for the hack. And many thanks to Boofo whose previous posts (see page nine) have helped get it working for me.
* Rose pounces on install
Outta curiosity - If I wanted to limit the usergroups that are eligible for the Member of the Day, I'd simply plug in the appropriate numbers as shown below, right? I mean, the below will pull members from usergroups 5,6,7, & 2, right?
$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");
Boofo
03-06-2003, 08:48 PM
Yes. ;)
:) I knew you'd be to my rescue. Thanks, Boofo!
Boofo
03-06-2003, 09:23 PM
You're very welcome. ;)
I'm having the "member shows up repeatedly 2/3 times" problem and have applied mheinemann and boofo's update to this. But will this limit the number of times a member can be chosen ina specific set of time?
For instance, I do not want the same member of the day more than one time every XX days (thirty, preferably), but I do not want the member's activity level to be a qualifying factor. For ever member of the day who catches themself as the "motd", I will give them a free Sunday Brunch to our restaurant. This is why I don't want the same member showing up but once a month, basically.
I've read through the thread and haven't found a solution for this. Any takers?
Boofo
03-08-2003, 04:59 PM
Ok, try this:
Change:
WHERE userid<>$daybits[1]
to:
WHERE userid<>$daybits[1] AND lastvisit>".time()-(86400*30)."
Thanks, Boofo.
I'm not sure if it works (as it's hard to test, obviously), but I have faith in your code and it gives me no errors. :)
This makes it so that a member can only be MOTD once every 30 days, regardless of activity and such.
Thanks again!
Boofo
03-08-2003, 05:48 PM
Keep an eye on it a couple of days and let me know how it goes. I changed it on my site and will also keep an eye on it, although I don't have very many members. It should work fine, though. ;)
It goes by the last site visit so activity should have nothing to do with it.
Originally posted by Boofo
Keep an eye on it a couple of days and let me know how it goes. I changed it on my site and will also keep an eye on it, although I don't have very many members. It should work fine, though. ;)
*hehe* Aye aye! I'll keep an eye on it. I don't have many members, either. In all usergroups, I have approximately 125 members and I've limited the "MOTD" to only two usergroups (approximately 106 so far) - so I'm quite small as well. :D
Boofo
03-08-2003, 06:06 PM
I mainly use my site for installing and playing with hacks. Kind of a learning center, I guess. I have about 25 users and most of them only show up once in a while. ;)
Zachery
03-08-2003, 06:14 PM
.
Ummm, yeah. Boofo? The fix we tried comes up with a great big ol' db error when resetting. :) Try again? Or is it the "rand now" fix I tried? :S
Database error in vBulletin 2.2.8:
Invalid SQL: -2592000
AND (usergroupid=8
OR usergroupid=2)
ORDER BY RAND(NOW())
LIMIT 1
mysql error: You have an error in your SQL syntax near '-2592000
AND (usergroupid=8
' at line 1
mysql error number: 1064
Date: Sunday 09th of March 2003 12:13:48 AM
Script: http://mysite/forum/
Referer:
* Rose goes to restore.
Boofo
03-09-2003, 09:30 AM
Sorry about that. That isn't going to work. I got the same error. I will dig into the code a little more and get a fix for you shortly. ;)
Kars10
03-09-2003, 10:42 AM
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. ;)
mheinemann
03-09-2003, 12:47 PM
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. ;)
https://vborg.vbsupport.ru/showthread.php?postid=218606#post218606
Kars10
03-09-2003, 01:31 PM
Cool thanks Mheinemann! ;)
*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.
Boofo
03-12-2003, 10:32 AM
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.
$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. ;)
:D Sweet. Thanks, Boofo. Even more random than random? Can't beat that! *lol*
* Rose installs fix, edits as needed, and is mucho greatful
Boofo
03-12-2003, 01:14 PM
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. :D 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. :D Sorry if I mislead/misunderstood.
* Rose sings "It's a small world"
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. :(
Boofo
03-12-2003, 03:04 PM
So I guess there's an extra free Sunday Brunch now that needs a home? ;)
raptor260
03-13-2003, 12:35 PM
I have Vbulletin 2.2.9, It shows the member of the day, but it never changes. It show the same member all the time every time.
What could my problem be.
http://www.byuboyz.com
*hehe* Hey Boofo - I've got a dupe motd. It's not a biggie, but I wanted to let you know. The dupe was motd on 3/17 and 3/22.
Raptor - look back a page or two in this thread and I believe there's a fix for your problem. :)
Boofo
03-22-2003, 08:45 PM
Today at 12:20 PM Rose said this in Post #201 (https://vborg.vbsupport.ru/showthread.php?postid=371406#post371406)
*hehe* Hey Boofo - I've got a dupe motd. It's not a biggie, but I wanted to let you know. The dupe was motd on 3/17 and 3/22. :)
I noticed the same thing a few days ago on my site. I will look at the code and see what I can figure out. Sorry about that. ;)
Crazy Pete
03-26-2003, 09:05 PM
Rather than have it choose a member at random, how can I make it so that the member of the day is the person with the highest amount of posts that day?
Today at 05:05 PM Crazy Pete said this in Post #203 (https://vborg.vbsupport.ru/showthread.php?postid=373792#post373792)
Rather than have it choose a member at random, how can I make it so that the member of the day is the person with the highest amount of posts that day?
https://vborg.vbsupport.ru/showthread.php?s=&threadid=50733 You might want to try that. :D
Boofo - Not a problem at all. :D I'm thinking of adding some way to track the past X members of the day in a list of sorts. Like five days. Wanna point me in a direction? I keep track for reasons of giving away a free brunch, as established, but I keep an Excel sheet. I'm only afraid to miss weekends or when I'm not at the work computer which is why keeping track of the most recent 2-5 members or so might be nice.
NexDog
04-06-2003, 03:54 AM
Is this compatible with 2.3.0? I notice it's no longer in use here....
Boofo
04-06-2003, 03:59 AM
It looks like a few have been removed and a few added here and there. ;)
Genocide
04-06-2003, 06:09 AM
nice
NexDog
04-06-2003, 06:20 AM
But will it work with 2.3.0?
RetroDreams
05-14-2003, 01:28 PM
Is there a way this can work with vbHome lite 4.2? I'd really like to add this, but that is where I'd want it to be.
RetroDreams
05-25-2003, 05:09 PM
OKay, I've installed this but even with all the different versions of lastactivity in the query, it still pulls people who haven't been active in months on my site. Anyone with a working query?
Also, I have modified it slightly to add the posts and title so they show up on my main page and it works fine with the manual reset, but doesn't work when it is automatically reset. What do I need to do to make sure it works with that as well?
Djidane Tribal
05-26-2003, 02:40 PM
<a href="http://foros.animeko.com.mx/memberofday" target="_blank">http://foros.animeko.com.mx/memberofday</a>[1].hack.php
What Happen !
reismarktq2
06-19-2003, 06:45 PM
I'm trying to figure out the code necessary to make the words "Member of the Day" appear in the postbit of the MOTD, and I'd appreciate a little help...
I know the code needs to go somewhere in showthread.php. I'm not sure exactly where in the file it should go, but at the very least, I know it needs to start with the same code that the index.php uses: $getdaytemplate=$DB_site->query_first("SELECT template FROM template WHERE title='memberoftheday' AND templatesetid=-2");
$daytemplate=$getdaytemplate['template'];
$daybits=explode('||vb||',$daytemplate);The next logical step from there would be an if statement that would run if $daybits[1] and the poster ID (what would the variable be?) matched up. That would be followed by a line establishing the variable $motd with the HTML code (properly slashed, of course) I want. Once that's done, then put $motd in the postbit template where I want it to go.
Can someone help make this vision work? I love the idea for the hack but I don't want to install it if I can't have this postbit thing... Boofo?
NexDog
06-19-2003, 09:55 PM
You're trying to make it so that when a member is Member of the Day, it says so in that member's postbit? That would be pretty cool. :)
reismarktq2
06-24-2003, 07:27 PM
I figured it out!
Click here (https://vborg.vbsupport.ru/showthread.php?postid=412378#post412378) to see...
:)
Boofo
06-24-2003, 08:02 PM
How many queries will that add, though? Won't it add a query for each member?
reismarktq2
06-24-2003, 08:43 PM
Ooo... yeah, you're right, Boofo. Is there some other way I can code it so that it'll only perform one query?
Boofo
06-24-2003, 08:51 PM
I'm not really sure how to pull this one off. Give me some time to see what I can come up with. ;)
reismarktq2
06-24-2003, 09:09 PM
Never mind... I figured something out myself. :) Here's what I did... (This assumes you have it installed.)
1. Run the following query: ALTER TABLE user ADD motd SMALLINT(6) DEFAULT '0' NOT NULL; 2. Find this comment in index.php: /* 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?! */ Add directly below it: $DB_site->query("UPDATE user SET motd='0' WHERE userid=$daybits[1]"); 3. Still in index.php, find: $DB_site->query("UPDATE template
SET template='".addslashes($newtemplate)."'
WHERE templatesetid=-2
AND title='memberoftheday'"); Add directly below it: $DB_site->query("UPDATE user SET motd='1' WHERE userid=$newmember[userid]"); 4. In admin/functions.php, find: eval("\$post[profile] = \"".gettemplate("postbit_profile")."\";"); Add directly ABOVE it: if ($post[motd]) {
$motd = "<smallfont><b>Member of the Day!</b></smallfont><br>";
} 5. Add $motd to your postbit template.
This not only adds two queries to the home page (which is not good, but better than 25+ more queries on each showthread page) but it allows the Member of the Day to be recorded as a variable in the user table. This might be useful if, say for instance, one wanted to have multiple Members of the Day for some reason. :)
Boofo
06-24-2003, 09:15 PM
What? Now I'm interested in what I missed. ;)
NexDog
06-24-2003, 10:41 PM
Does this work?
reismarktq2
06-25-2003, 10:13 AM
It works great on my boards...
And just to clarify something. What I did adds two additional queries to the homepage, but those queries only run when the member of the day gets changed (i.e. once a day or whenever the admin adds the parameter) so it shouldn't adversely impact the homepage's regular performance. :)
NexDog
06-25-2003, 12:29 PM
Extra cool. So those 2 queries are only added on one page view as that's all it takes to switch MOTD. I'm definitely trying to keep queries down on the home page at least...
Darkmeteor
08-01-2003, 05:57 PM
here's a slight variation for the member of the day hack
I did it on my boards, and it works fine.
I modified the code to use the table word from vbulletin. On my forum it's called the word of the day. Some words written from the members are just fun, especially when there are typo :)
for exemple : "Word of the day : pie"
geniuscrew
10-24-2003, 07:03 PM
Was Vivi Ornitier's emailing idea overlooked, because I think it's a wicked idea and should be considered.
I could actually put it to very good use because of a feature on my forums.
[RK]DarkKnight
10-27-2003, 02:32 AM
will this Member of the day hack work in 2.3.2??
NexDog
10-27-2003, 02:42 AM
DarkKnight']will this Member of the day hack work in 2.3.2??
It does. We have it running on ours.
cditty
08-29-2004, 11:05 PM
My people miss this after I upgraded.
Chris
pdatoon
08-30-2004, 12:41 AM
Anyone using that on a VB2 board so i can have a look?
does this hack work on vb3.0.3? just wondering...
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.