Poll votes based on user-reputation
When a user votes in a poll, the weight/importance of their vote is based on their reputation:<br />
<br />
In [polls.php] change the following code:<br />
<br />
<pre data-deferred="true" class="block-code line-numbers language-none"><code class="language-php">$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;</code></pre><br />
To make the change, find the uncommented part in the file, comment it out, and underneath it add the two lines, and uncomment those<br />
<br />
And to let them undo their votes (so that the second half of the above changes have any effect):<br />
AdminCP -> "Users & Groups" -> "Groups" -> (pick a group) "Options" -> "Edit Group" -> "Forums and Posts" -> "Can undo votes in polls?"<br />
<hr class="mycode_hr" />
I'm going to do something where:<br />
<br />
the top 25% reputation users have $votepower of 5<br />
the middle 50% reputation users have a $votepower of 3<br />
the bottom 25% reputation users have a $votepower of 1<br />
and negative reputation users (not sure if this is a thing?) have a $votepower of 0<br />
<br />
Not sure how I'm going to calculate those percentages yet though<br />
<hr class="mycode_hr" />
When you open a thread, it'll show the wrong # of votes after the above change<br />
<br />
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."<br />
<br />
And insert this code right above that comment:<br />
<br />
<pre data-deferred="true" class="block-code line-numbers language-none"><code class="language-php">$query = $db->simple_select("polls", "numvotes", "tid='".$tid."'"
;
$thispollqueryresult = $db->fetch_array($queryy);
$totalvotes = $thispollqueryresult['numvotes'];</code></pre>
When a user votes in a poll, the weight/importance of their vote is based on their reputation:<br />
<br />
In [polls.php] change the following code:<br />
<br />
<pre data-deferred="true" class="block-code line-numbers language-none"><code class="language-php">$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;</code></pre><br />
To make the change, find the uncommented part in the file, comment it out, and underneath it add the two lines, and uncomment those<br />
<br />
And to let them undo their votes (so that the second half of the above changes have any effect):<br />
AdminCP -> "Users & Groups" -> "Groups" -> (pick a group) "Options" -> "Edit Group" -> "Forums and Posts" -> "Can undo votes in polls?"<br />
<hr class="mycode_hr" />
I'm going to do something where:<br />
<br />
the top 25% reputation users have $votepower of 5<br />
the middle 50% reputation users have a $votepower of 3<br />
the bottom 25% reputation users have a $votepower of 1<br />
and negative reputation users (not sure if this is a thing?) have a $votepower of 0<br />
<br />
Not sure how I'm going to calculate those percentages yet though<br />
<hr class="mycode_hr" />
When you open a thread, it'll show the wrong # of votes after the above change<br />
<br />
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."<br />
<br />
And insert this code right above that comment:<br />
<br />
<pre data-deferred="true" class="block-code line-numbers language-none"><code class="language-php">$query = $db->simple_select("polls", "numvotes", "tid='".$tid."'"
$thispollqueryresult = $db->fetch_array($queryy);
$totalvotes = $thispollqueryresult['numvotes'];</code></pre>