vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Member of the Day! (https://vborg.vbsupport.ru/showthread.php?t=34779)

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.

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:

Matt 02-04-2002 05:38 PM

Great hack! Thanks mate :D

Bald Bouncer 02-04-2002 05:45 PM

very good! easy install and worked a charm!!

Dade 02-04-2002 06:25 PM

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

Quote:

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

Quote:

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:
Code:

                                      WHERE userid<>$daybits[1]
with this:
Code:

                                      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:
Code:

                                      WHERE userid<>$daybits[1]
with:
Code:

                                      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

Quote:

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

Quote:

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?

Mutt 02-10-2002 12:25 PM

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

Quote:

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

Quote:

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

Quote:

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


All times are GMT. The time now is 04:46 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01439 seconds
  • Memory Usage 1,818KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete