PDA

View Full Version : Must be member for X days before can vote on polls?


WreckRman2
08-28-2004, 02:18 AM
I started a contest on my site wouldn't you know it I am seeing new members signup then vote on a poll. I'd like to set up a way to stop this and the simplest way would be to require a member to be registered for X amount of days before they can vote on a poll. This way if I run a poll for 7 days I can set it to not allow new members to vote until they have been a member for 8 days.

Anyone know how this can be done?

Thanks in advance!

Tekton
08-28-2004, 04:52 AM
I started a contest on my site wouldn't you know it I am seeing new members signup then vote on a poll. I'd like to set up a way to stop this and the simplest way would be to require a member to be registered for X amount of days before they can vote on a poll. This way if I run a poll for 7 days I can set it to not allow new members to vote until they have been a member for 8 days.

Anyone know how this can be done?

Thanks in advance!

Sounds as simple as a user promotion to a "can vote" additional group.

How, well set the usergroup settings for registered users to not be able to vote, and then make a new user group based of registered that CAN vote. Then make a promotion that runs after you have been there for X days. and have that put them in an additional group that you made. =3

WreckRman2
08-28-2004, 05:25 AM
That would work but seem like alot of extra work needed. Changing usergroups just for this seems like too much.

Thanks.

Tekton
08-28-2004, 05:28 AM
aw, wouldn't be that much. We have a LOT of additional groups for priveledges. ;)

WreckRman2
08-28-2004, 05:40 AM
Seems like it would be simpler to edit the permissions line in poll.php.

if (!($forumperms & CANVIEW) OR !($forumperms & CANVOTE))
{
print_no_permission();
}

Simply add another OR $bbuserinfo[joindate ]<10

I know thats all wrong because first you must determine the join date and todays date then see if they are more than the desired time frame.

WreckRman2
08-28-2004, 05:56 AM
Well I took the easy way out for now and used :

if (!($forumperms & CANVIEW) OR !($forumperms & CANVOTE) OR $bbuserinfo[posts]<1 )
{
print_no_permission();
}

This will deny a member from voting unless they have at least one post. I'd rather have a date because many members register and never post but still enjoy polls, etc. Once I figure it out I will share my findings.

I just want to prevent someone from registering new names just to vote for themselves.

WreckRman2
08-28-2004, 06:47 AM
OK, here we go...

Open poll.php and search for:

// other permissions?

Add below it:

$bbuserinfo['datejoined'] = vbdate($vboptions['dateformat'], $bbuserinfo['joindate']);
$jointime = (TIMENOW - $bbuserinfo['joindate']) / 86400; // Days Joined

Below that look for:

if (!($forumperms & CANVIEW) OR !($forumperms & CANVOTE))
{
print_no_permission();
}

Change to:

if (!($forumperms & CANVIEW) OR !($forumperms & CANVOTE) OR $jointime<10 )
{
print_no_permission();
}


Change $jointime<10 to how ever many days you wish to set it to. This means a user can not vote on a poll if they have not been a member for at least 10 days.


I also added this to my nopermission_loggedin phrase:

<li>If you are trying to vote on a poll, you must be a member for at least 10 days before you can vote on polls.</li>

oldford
09-19-2005, 04:10 PM
I know this is an old post, but I wanted to thank IndyWebDesign for the code. It was exactly what I needed. Many times people figure out the answer to their original question, but don't ever come back and let the rest of us know what it is.

SilverBoy
03-29-2006, 10:49 AM
it's good, but we need it as a real hack, to set deffrint amount of days and posts to every poll.