MyBB Community Forums

Full Version: minimum posts count to vote in a particular poll
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Forgive me if this already exists. I'm looking for a way to set a minimum post count in order to vote in a particular poll. Can this be done with a plug in or perhaps another simple way?

Thanks,

Jeremy
Can anyone lend a hand?
Tomorrow i'll release the plugin.

If you can't wait then these are the code edits that you need to do:
Open polls.php.

Find
if($mybb->input['action'] == "vote")
{
Below add:
	if(!is_moderator("", "", $mybb->user['uid']) && intval($mybb->user['postnum']) < 15)
	{
		error("You don't have enough posts to vote");
	}

I didn't test it but it should work
Much appreciated sir.
Does this work globally or on specific polls? I would like to work on specific polls.
On specific forums for now...
I'm not too knowledgeable in this area. So, if I paste the above code what variables do I need to change to meet my specific needs? For example, poll ID and minimum votes.
if(!is_moderator("", "", $mybb->user['uid']) && intval($mybb->user['postnum']) < 15)
{
error("You don't have enough posts to vote");
}

I am guessing that you need to change the "< 15)" bit at the end of the first line. This should change that amount of posts a user needs. "< 15)" means the user needs over 15 posts.

I think that what it is. Not 100% sure, sorry.
That is what I thought too. Question I have is how do I point this mod to a specific poll ID?
Possible changing the ['uid'] ?

I have no idea. Sorry.
Find:
	if(!$poll['pid'])
	{
		error($lang->error_invalidpoll);
	}
Add bellow
elseif(!is_moderator("", "", $mybb->user['uid']) && intval($mybb->user['postnum']) < 15 && $poll['pid'] == "xx" )
{
error("You don't have enough posts to vote");
}
Pages: 1 2