< Back to Switches

Member Ratings

The member rating option at Admin Panel -> Members -> Member Settings -> "Member Rating Formula" gives you the opportunity to create a rating system to measure the contributions of your members. This is an advanced task, PHP knowledge is helpful, but feel free to contact support to ask for guidance on how to create the rating formula you desire.

An example formula:
$rating = ($this->submissions() * 2) + $this->postcount()

That formula doubles the number of listings submitted and adds the number of comment posts submitted. You can reference any mysql _members table field with $this->fieldname, or any method of the classes/member.php or classes/generic.php classes with $this->methodname().

The default formula is
$rating = $this->standardformula()
This is a special formula designed to work with {MEMBERRATINGPERCENTIMAGE} to display a graphical bar showing the strengths of members from 0 to 100. It's a complicated formula that judges people based on how others have rated their listings and posts -- basically the larger percentage of people approve of their submissions the higher their rating and the longer their rating bar graphic. Here's the code:

$comresult = $this->commentapprovalnorm();
$linresult = $this->linkratingnorm();
$votes = $this->linkratingnormvotes;
$total = $this->commentapprovalnormvotes;
if (!$votes && !$total || ($votes+$total < 5)) $result = 0;
else { $result = $comresult * ($total/($votes+$total)) + $linresult * ($votes/($votes+$total)); }
$result = $result * 100; // rating from 0 to 100
$result = round($result, 0); // whole numbers
if ($votes+$total > 5 && $result == 0) $result = 1; // to distinguish from the unrated


You can show a member's rating on their profile or next to their posts/listings by using the template variable {MEMBERRATING}. You can specify how many digits to round the member rating to by passing that as a paramater to the template function. For example, {MEMBERRATING[2]} would round the rating to two decimal places. Note that if you want to get really tricky you can also pass a custom formula to the template variable, like {MEMBERRATING[2 <,> $rating = $this->postcount() + $this->submissions()]}

Important note: After you change the member rating formula, the change will not be applied to existing members until they submit something or you regenerate members at Admin -> Maintenance -> Regenerate.