Quantcast
Channel: MyBB Community Forums - Tutorials
Viewing all articles
Browse latest Browse all 690

Poll votes based on user-reputation

$
0
0
When a user votes in a poll, the weight/importance of their vote is based on their reputation:

In [polls.php] change the following code:

$votesarray[$voteoption-1]++;
//$votepower = $mybb->user['reputation'];
//$votesarray[$voteoption-1] = $votesarray[$voteoption-1] + $votepower;

$votesarray[$option-1]++;
//$votepower = $mybb->user['reputation'];
//$votesarray[$option-1] = $votesarray[$option-1] + $votepower;

--$votesarray[$vote-1];
//$votepower = $mybb->user['reputation'];
//$votesarray[$vote-1] = $votesarray[$vote-1] - $votepower;

--$votesarray[$voteoption-1];
//$votepower = $mybb->user['reputation'];
//$votesarray[$voteoption-1] = $votesarray[$voteoption-1] - $votepower;

To make the change, find the uncommented part in the file, comment it out, and underneath it add the two lines, and uncomment those

And to let them undo their votes (so that the second half of the above changes have any effect):
AdminCP -> "Users & Groups" -> "Groups" -> (pick a group) "Options" -> "Edit Group" -> "Forums and Posts" -> "Can undo votes in polls?"

I'm going to do something where:

the top 25% reputation users have $votepower of 5
the middle 50% reputation users have a $votepower of 3
the bottom 25% reputation users have a $votepower of 1
and negative reputation users (not sure if this is a thing?) have a $votepower of 0

Not sure how I'm going to calculate those percentages yet though

Viewing all articles
Browse latest Browse all 690

Trending Articles