2020-10-01, 10:42 AM
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:
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
When you open a thread, it'll show the wrong # of votes after the above change
To fix it, go to ~line 608 in [showthread.php], find the comment "// Decide what poll status to show depending on the status of the poll and whether or not the user voted already."
And insert this code right above that comment:
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
When you open a thread, it'll show the wrong # of votes after the above change
To fix it, go to ~line 608 in [showthread.php], find the comment "// Decide what poll status to show depending on the status of the poll and whether or not the user voted already."
And insert this code right above that comment:
$query = $db->simple_select("polls", "numvotes", "tid='".$tid."'");
$thispollqueryresult = $db->fetch_array($queryy);
$totalvotes = $thispollqueryresult['numvotes'];