PDA

View Full Version : User rating calculated via reputation points/post count


steve71
06-22-2007, 11:14 PM
With the rep system currently, new members are lost in the sea of reputation totals from senior members, and its impossible to determine if they are low rep for any reason..it undermines the whole rep system because it's ambiguous.

Why not have a rep display that determines your average rep per post...this way a new member can get in on the game and get noticed as a substantial contributor immediately.

These ratio's are reached by:Reputation/posts

Member 1
Posts: 2190
Reputation: 1256
Average: .57

Member 2
Posts: 710
Reputation: 1219
Average: 1.71

Member 3
Posts: 66
Reputation: 278
Average: 4.20

As you can see clearly member 3 is on course to being the most reputable of the bunch, whereas without the average displayed, he would go virtually un-noticed.

Is this something that can be implemented easily?

steve71
06-23-2007, 04:08 PM
So far I've managed this result. Anyone php saavy able to have the calculations done hidden, and make "average" a variable (quotient ) to display in the postbit?

<div>Average = $post[reputation] / $post[posts]

(see screen shot)

steve71
06-23-2007, 11:14 PM
$post[reputation]/$post[posts]
<?php $userrating = $post[reputation]/$post[posts]; echo $userrating; ?>

eg this puts: 220/93 in the postbit, below the reputation points total -
I just can't get it to calculate and place the quotient instead.

Suggestions?

Do I have to run the php function from reputation.php and then call up the variable from the postbit template?

I see there may be other issues:

http://www.vbulletin.com/forum/showthread.php?t=234222

so I guess I need a plugin. How would I know where the hook location is for this modification?

reputation.php?

Dismounted
06-24-2007, 06:05 AM
Use this in the template:
<if condition="$post[average] = $post[reputation] / $post[posts]">$post[average]</if>

steve71
06-24-2007, 06:26 AM
I get this error when I attempt to save the template after changes.

Warning: Division by zero in /includes/adminfunctions_template.php(3596) : eval()'d code on line 64


If I wanted to have [User rating] instead of [average], which [] would be [userrating] and which would be [User rating] ?

Thanks btw!


UPDATE
Ok, I ignored the warning as it has to do with members starting with 0 posts. Anyway, it calculates correctly as long as the amount of reputation being divided is greater than the total posts.

ie

1200 reputation/400 posts is ok - except it brings it to the 8th decimal..can I limit it to 2 decimal points?

400 reputation/1200 posts would result in an incorrect number (sometimes just repeats the reputation points # again)

Dismounted
06-25-2007, 06:37 AM
<if condition="$post[reputation] != 0"><if condition="$post[average] = $post[reputation] / $post[posts]">$post[average]</if></if>

steve71
06-25-2007, 06:53 AM
OK. I no longer got the error message about dividing by zero...:)

This is the result.
There are a lot of decimals, and when the reputaion points are less than the post count, it just repeats the reputation number.

I appreciate your help.
Any fix for these two things?

Dismounted
06-25-2007, 11:37 AM
<if condition="$post[reputation] != 0"><if condition="$post[average] = vb_number_format($post[reputation] / $post[posts], 2)">$post[average]</if></if>

steve71
06-25-2007, 01:14 PM
I received this error when trying to save the changes:


The following template conditional expression contains function calls:

<if condition="$post[average] = vb_number_format($post[reputation] / $post[posts], 2)">

Function Name Usage in Expression
vb_number_format vb_number_format($post[reputation] / $post[posts], 2)

With a few exceptions, function calls are not permitted in template conditional expressions. Please go back and re-write this expression.

The following functions are allowed in template conditional expressions:
in_array() is_array() is_numeric() isset() empty() defined() array() can_moderate() can_moderate_calendar() exec_switch_bg() is_browser() is_member_of()

Dismounted
06-26-2007, 07:40 AM
Damn, you might have to add a plugin then. Put this in your template:
$post[average]
Add a plugin at 'postbit_display_complete, PHP code:
if ($post['reputation'] != 0)
{
$post['average'] = vb_number_format($post['reputation'] / $post['posts'], 2);
}

steve71
06-26-2007, 08:31 AM
Ok. This did limit the quotients to 2 decimal points... but it still produced the wrong results as before when dealing with members having less reputation points than post count.
(it just repeats the reputation points #)

:cool:

Dismounted
06-26-2007, 09:35 AM
What do you want it to do? It's performing the calculation you told it to do.

steve71
06-26-2007, 02:04 PM
Ok. This did limit the quotients to 2 decimal points... but it still produced the wrong results as before when dealing with members having less reputation points than post count.
(it just repeats the reputation points #)

:cool:

This attachment was from before the decimals were reduced, but it shows the example of the other problem:

http://www.vbulletin-faq.com/forum/attachment.php?attachmentid=1377&d=1182758611
959/1546 = 959 ???
>
>
>

Dismounted
06-27-2007, 09:38 AM
Heh, I don't know what's wrong with it, what hacks have plugins hooked at postbit_display_complete?

steve71
06-27-2007, 11:48 PM
1. vB Ad Management - Ads in Postbit (disabled)
2. Remove popup rep (I believe this refers to the User Defined Reputation Points hack)

steve71
07-02-2007, 02:15 PM
Sorry man..that's works perfectly. I didn't realize before that part of the code was a plugin.
Thanks!

UPDATE:

This calculation works perfectly unless the members post count is 1000 or more. In that case it just repeats the users reputation points in the "User rating" location.

Join Date: Jan 2007
Posts: 999
Rep points: 300
User rating: 0.30

Join Date: Jan 2007
Posts: 1,000
Rep points: 300
User rating: 300.00

steve71
07-03-2007, 11:44 PM
Just in case anybody wants to apply this mod, this link explains how to make it work. Thanks for your help Dismounted. :up:

http://www.vbulletin.com/forum/showthread.php?t=235180