PDA

View Full Version : Release v2.0.1: Simple hack: minimum posts to poll


unixman
19 Jun 2001, 18:22
Simple hack - nothing fancy. Not control panel enabled, but I don't care about that right now. If you can use it, great. If not, bugger off. Feel like adding a control panel option for it, do it yourself. :-)

This hack forces each user to have a minimum number of posts under their belt before participating in a poll. This can be cool, especially if people are voting to elect moderators, help shape board policy, etc. Prevents them from practically creating dummy accounts to run the votes up.

In poll.php:

Find:


//check if an option was selected
if (isset($optionnumber)) {


Add this beneath it:


// HACK - Check to make sure user has enough posts under their belt to poll
$posts_needed_to_poll = 50;

$post_diff = $posts_needed_to_poll - $bbuserinfo[posts];

if($post_diff > 0) {
eval("standarderror(\"".gettemplate("error_poll_not_enough_posts")."\");");
exit;
}

// END HACK



You'll also need to add a template called "error_poll_not_enough_posts". In it, put something like:


We're sorry, but you need at have posted at least 50 messages before you can participate in our polls.


Cheers.