vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   [VB3 RC3] Member of the day (https://vborg.vbsupport.ru/showthread.php?t=60368)

Kentaurus 01-16-2004 10:00 PM

[VB3 RC3] Member of the day
 
Tested in 3.0.1

This hack lets you "elect" a member of the day (member of any period of
time actually, but defaults to member of the day).

The member of the day is someone randomly picked from all the users in
your forum that have certain amount of posts the day before, that have
visited the forum and that have at least 50 posts and 10 reputation. You
can also change that values.

By default it appers in top of the forumhome. It is a nice way for members
of the forum to get to know each other.

Info for hackers:
You may modify, improve, upgrade, redistribute this hack, include it
in another hack or yours or translate it provided you do it free of
charge and you distribute it in www.vbulletin.org at least, there is no
need to pm me asking for permission
Some portions of the code are (c) Jelsoft Enterprises Ltd.

Kentaurus 01-17-2004 08:25 PM

Tu further customize this hack you can edit the memberoftheday.php files, the settings are:

This is a comma separated list of the groups that will not be considered for the member of the day. Banned usergroups should be here.

$restrictedGroups = "3,4";

This are the minimum posts a user must have, if a user has less than 50 posts for example he cannot be selected member of the day

$posts = 50;

Since it makes no sense to make a user that visited the forum a month ago member of the day you can specify the number of days ago the user must have visited the forum. In this example if the user didn't visit the forum yesterday he is not elegible for member of the day

$lastactivity = 1;

Similar to the last setting only the user not only has to visit the forum but also has to post.

$lastpost = 1;

Users with less than x reputation will not be selected.

$reputation = 10;

As soon as a user is selected he cannot be selected again in this number of days. This gives other users a chance to be elected member of the day. In this example once a user was selected member of the day he cannot be selected again in 60 days.

$days = 60;

The member of the day shows the "favorite forum" of the user. This is the forum the user has more posts in. If by chance it is a private forum the name of the private forum will appear there. You might not want other users to see that because they cannot enter that forums anyway. Put a comma separated list of your private forums.

$privateForums = "1,2,3";

MindTrix 01-17-2004 08:28 PM

Looks like a nice idea, a screenshot would be nice aswell incase something goes wrong with your site.

Note the link in your first post isnt even a link to your site ;) (check your spelling in it)

NTLDR 01-17-2004 08:31 PM

Would be nice to see proper permissions for the forums. Good to see some use of the datastore and the cron system here.

Kentaurus 01-17-2004 08:46 PM

Quote:

Originally Posted by NTLDR
Would be nice to see proper permissions for the forums. Good to see some use of the datastore and the cron system here.

You mean something like this?

PHP Code:

$forumpermsmday fetch_permissions($mday['forumid']);
if (!(
$forumpermsmday CANVIEW))
{
 unset(
$mday['forumid']);
 unset(
$mday['forumname']);


This will hide the forum from the users that cannot see them. A conditional in the template is also needed.

However there is no easy way to do this. Even if the forum is not shown the user can know that since there is no favorite forum it means that the user has 0 posts (not likely) or the forum is a private one. Then he knows that there are private forums. Sometimes you don't even want your users to know that there are private forums.

Of course, I could always run the favorite forum check at index.php and if the first forum can't be seen I would go for the second, third or fourth one. But that query is a little heavy and I wouldn't like it to run at the index page.

NTLDR 01-17-2004 09:13 PM

The 2nd, 3rd etc forums could be stored during the cron preventing the need to add extra queries on every index.php load then use code similar to what you posted along with some conditionals to display it.

AN-net 01-18-2004 03:48 PM

is there a way this could be modifed that the member of the moment has like a special title in their profile and postbit? just wondering;)

Chris-FH 01-18-2004 03:57 PM

I love this hack... :up:

At my Forum, we call it Camel of the Day :D

Great Work!

C.

Boofo 01-19-2004 05:28 AM

Tha age part of this hack is way off. It shows 34 for mine and it should be 49. ;)

gmarik 01-19-2004 07:15 AM

This is great - It could be used on KuraFire's Journal hack as well (hint, hint)

Kentaurus 01-19-2004 11:51 PM

Quote:

Originally Posted by Boofo
Tha age part of this hack is way off. It shows 34 for mine and it should be 49. ;)

Are you sure you have your correct year of birth in your member's info? Age seems to be working for me...

Boofo 01-20-2004 12:21 AM

Quote:

Originally Posted by kentaurus
Are you sure you have your correct year of birth in your member's info? Age seems to be working for me...

Change your birthday to January 31st, 1954 and check it out. It shows up as 49 everywhere else just fine. ;)

Link14716 01-20-2004 02:07 AM

Quote:

Originally Posted by kentaurus
Are you sure you have your correct year of birth in your member's info? Age seems to be working for me...

Sounds like the old infamous January 1st, 1970 bug.

dede1 01-20-2004 10:33 PM

I do not have a problem, no Avatar lock here:

http://63.246.136.220/Board

Boofo 01-20-2004 11:11 PM

Quote:

Originally Posted by Link14716
Sounds like the old infamous January 1st, 1970 bug.

That's exactly what I was going to suggest except I though the bug had been squashed. ;)

Anyone got a fix for it?

dede1 01-21-2004 03:23 AM

I have

PHP Code:

 <td><img src="image.php?u=$mday[userid]"></td

that now assigned

PHP Code:

<td><img srclink adress<td


Looks better than this cross

gmarik 01-21-2004 05:20 PM

You could export the limitating settings (group id, post minimum) to the admin cp input boxes so I could change it not connecting with ftp to my page, ok?

Kentaurus 01-21-2004 05:39 PM

Quote:

Originally Posted by Boofo
That's exactly what I was going to suggest except I though the bug had been squashed. ;)

Anyone got a fix for it?

That's because... nobody told me about that January 1970's bug :) It is new to me.

Fixed. Just download the new memberoftheday.php


Also, I just tested this hack with RC3, it works fine.

Boofo 01-22-2004 01:15 AM

You might want to change the name of the age variable in the text file, too, since you renamed it in the php file. ;)

Kentaurus 01-22-2004 08:46 AM

Quote:

Originally Posted by Boofo
You might want to change the name of the age variable in the text file, too, since you renamed it in the php file. ;)

It wasn't renamed, it is still $mday['age']. I renamed other variables but they shouldn't harm the templates or the index.php modifications

Boofo 01-22-2004 07:00 PM

You're right. I apologize. I was trying to put it on my forumhome at the bottom so I wasn't using the template. Using mday[age] worked fine. I was looking at the code in the php file and it said memberoftheday[age] which, or course, didn't work. Needless to say, I was confused. But all is well now. ;)

Boofo 01-22-2004 07:03 PM

What does unserialize actually do? Is that like the RAND() variable or am I missing something?

NTLDR 01-22-2004 07:12 PM

http://uk2.php.net/manual/en/function.serialize.php
http://uk2.php.net/manual/en/function.unserialize.php

Quote:

serialize() returns a string containing a byte-stream representation of value that can be stored anywhere.

This is useful for storing or passing PHP values around without losing their type and structure.

To make the serialized string into a PHP value again, use unserialize(). serialize() handles all types, except the resource-type. You can even serialize() arrays that contain references to itself. References inside the array/object you are serialize()ing will also be stored.
Used quite alot in vB3, the majority of the stuff in the datastore table is serailized.

Kentaurus 01-23-2004 02:57 AM

Quote:

Originally Posted by Boofo
What does unserialize actually do? Is that like the RAND() variable or am I missing something?

Serialization is a method for making an object persistent in an OO language. You serialize the object and the use it later. PHP is still not so OO but still the serialization is a method to store data, in this case an array. I serialize an array, store it someplace then unserialize the data and get back my array. It is really useful because I can have arrays in arrays, different data types... almost everything.

Boofo 01-23-2004 10:11 AM

I'll have to look into that more. Thanks for explaining it. ;)

Also, here is what I get for an age for someone who hasn't entered a birthday.

(Age: 2004).

AutomatikStudio 01-24-2004 03:06 PM

When I try to run the cron I get: "Couldn't elect a member of the day, not enough members"...i have a couple of hundred members and I check to make sure the correct usergroups weren't restricted. Also the member box on FORUMHOME is just showing blank b/c it hasn't selected anybody.

Kentaurus 01-24-2004 07:33 PM

Quote:

Originally Posted by AutomatikStudio
When I try to run the cron I get: "Couldn't elect a member of the day, not enough members"...i have a couple of hundred members and I check to make sure the correct usergroups weren't restricted. Also the member box on FORUMHOME is just showing blank b/c it hasn't selected anybody.

Maybe you should lower the restrictions for the member of the day, maybe none of them have 50 (or the number you set) posts, or they all have less than 10 of reputation, or maybe no one has posted recently and the lastactivity var is set to 1 or something very low.

AutomatikStudio 01-26-2004 01:07 AM

Quote:

Originally Posted by kentaurus
Maybe you should lower the restrictions for the member of the day, maybe none of them have 50 (or the number you set) posts, or they all have less than 10 of reputation, or maybe no one has posted recently and the lastactivity var is set to 1 or something very low.

I've got it set to where no groups are restricted, 0 posts, no last days logged in, a reputation of 0, etc....i've got it set to where anybody can get picked.

Kentaurus 02-01-2004 08:43 PM

Quote:

Originally Posted by AutomatikStudio
I've got it set to where no groups are restricted, 0 posts, no last days logged in, a reputation of 0, etc....i've got it set to where anybody can get picked.

Then anybody has posted in that day? It needs at least 1 user with 1 post... I can't think right now in anything else that could be causing that

Boofo 02-01-2004 09:07 PM

kentaurus, can you look at post 25 here and see if you can figure out why this is doing that, please, sir? ;)

Kentaurus 02-05-2004 02:26 AM

Quote:

Originally Posted by Boofo
kentaurus, can you look at post 25 here and see if you can figure out why this is doing that, please, sir? ;)

Yes, you are right. Fixed. In memberoftheday.php

find this:
Code:

  if ($year > $date[2] AND $date[2] != '0000')
change it to:
Code:

  if ($year > $date[2] AND $date[2] != '0000' AND $date[2])
file updated also

KuraFire 02-05-2004 08:02 AM

Quote:

Originally Posted by gmarik
This is great - It could be used on KuraFire's Journal hack as well (hint, hint)

Only if he would turn this into a Module for the Modules Manager, though. :)

Kentaurus 02-05-2004 08:32 AM

Quote:

Originally Posted by KuraFire
Only if he would turn this into a Module for the Modules Manager, though. :)

But first I would need an explanation of what is that modules manager.....
Anyway... I am expecting HTL 1.1 before any other hack, I am not releasing HTL hacks until I can make the .txt from there... it is really bothersome to do both an HTL and a TXT

rinkrat 02-14-2004 06:53 PM

I'm getting this, do I need to wait for the cron to run or something?

Kentaurus 02-14-2004 10:21 PM

Quote:

Originally Posted by rinkrat
I'm getting this, do I need to wait for the cron to run or something?

Wait for the cron or run it yourself at the admin control panel, it needs to be run at least once for the information to be generated.

KuraFire 02-15-2004 09:42 AM

Quote:

Originally Posted by kentaurus
But first I would need an explanation of what is that modules manager.....
Anyway... I am expecting HTL 1.1 before any other hack, I am not releasing HTL hacks until I can make the .txt from there... it is really bothersome to do both an HTL and a TXT

read http://everythingvb.com/showthread.php?t=28 for an explanation on what the Modules Manager is :) (I'm not gonna cut-paste all that here)

and HTL 1.1 will come, I hope soon but I dunno how soon.. it's so much work :(

rinkrat 02-18-2004 05:42 PM

They are asking what they get for being MOTD. How can I rig it to give the member of the day 5000 reputation points?

Kentaurus 02-29-2004 05:51 PM

Quote:

Originally Posted by rinkrat
They are asking what they get for being MOTD. How can I rig it to give the member of the day 5000 reputation points?

Isn't that a lot? Oh anyway.

In the memberoftheday.php

Look for this:

Quote:

$memberOfTheDay['forumname'] = $favoriteForum['title'];
replace it with:

Quote:

$DB_site->query("UPDATE ".TABLE_PREFIX."user SET reputation=reputation+5000 WHERE userid=".$memberOfTheDay[userid]."");

$memberOfTheDay['forumname'] = $favoriteForum['title'];


Trunks ssj4 03-05-2004 01:02 PM

it is easy to change it to Member of the month? :rolleyes:

Kentaurus 03-06-2004 08:58 PM

Quote:

Originally Posted by Trunks ssj4
it is easy to change it to Member of the month? :rolleyes:

Sure. Just set your cron job to run monthly instead of daily.


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.01456 seconds
  • Memory Usage 1,843KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (21)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