vBulletin

Thank you for visiting. This is our website archive. Please visit our main website by clicking the banner above.
vBulletin FAQ is dedicated to helping the forum owner build, manage and profit from his vBulletin Forum
vBulletin Web Hosting - Free skins and styles for your vBulletin - Search Engine Optimization




User rating calculted via reputation points/post count

steve1971
06-24-2007, 10:47 AM
OK. I keep getting reminders to come on back here, so maybe you guys can help since vbulletin.com does not entertain modifications, and vbulletin.org is not the greatest when it comes to responding to posts.

http://www.vbulletin.com/forum/showthread.php?p=1377967#post1377967

http://i149.photobucket.com/albums/s69/brags71/average.gif


Divide reputation/post count to get user rating

--------------------------------------------------------------------------------

Code added in the postbit legacy template:
<if condition="$post[average] = $post[reputation] / $post[posts]">$post[average]</if>

Note about screenshot: with the recent code in red it now actually attempts to calculate..in the screen shot it just shows the location in the postbit.



Quote:
Originally Posted by steve1971;
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)

Peggy
06-24-2007, 11:10 AM
Steve, what, exactly, are you asking us for? :)

steve1971
06-24-2007, 11:05 PM
Sorry. Ok. The screen shot in my first post shows what I attempted. Average 220/93

Problem was everybody would have to grab a calculator to figure it out.

Basically by dividing the reputation points by post count you get a nice number that is more telling than just reputation points alone. I was going to call this number the "user rating".

A member with 200 posts and 400 rep (400/200) would have a 2 user rating; whereas another member with 800 posts and 600 rep (600/800) would have a 1.33 user rating.

At a glance you get a good idea who is a more credible poster. This is great for new members too with low post counts and rep points. A new member with only 20 posts and 50 rep points would have a 2.5 rating. This way they can join in the game right away...and instead of focussing on "more points" people will pay attention to "better user ratings"

Anyway, this code was suggested to me:

Code added in the postbit legacy template:
<if condition="$post[average] = $post[reputation] / $post[posts]">$post[average]</if>

Result: it calculated, but too many decimal points..and it calculated wrong in some instances. (see first post)

secondly I also received this error when trying to save the changes:

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


I just want to have this calculate correctly and display the quotient in the postbit. Is the code I pasted flawed? Is this an easy modification?

steve1971
06-25-2007, 01:03 AM
Update:

<if condition="$post[reputation] != 0"><if condition="$post[average] = $post[reputation] / $post[posts]">$post[average]</if></if>

With this new code the error message about dividing by zero doesn't appear.

Same problem though..too many decimals and if the reputation points are less than the post count it doesn't calculate properly.

steve1971
06-26-2007, 12:57 PM
So I guess no help? I'm not a coder, but seriously, this can't be that difficult to accomplish..any calculator from a dollar store can do this operation.

Paul M
06-26-2007, 01:24 PM
I still don't actually follow what your question is.

JFYI, You shouldn't be doing calculations in templates (allthough it works in a fashion) - calculations should be done in php in a plugin, all the template should do is display the answer.

IMO It's a flawed system anyway, we thought about doing this a while ago it then dropped the idea as a new member with just one or two posts can potentially have a much higher score than most established members.

steve1971
06-28-2007, 11:15 PM
OK. So I get spammed thru e-mail to come to this site, so when I do with a legitimate hack..that should be easy as hell for VB to accomplish..and all I get is a question what I am asking for..even though I could'nt have been more detailed about my explanation...and I get told my hack is "flawed".

Reputation is flawed and this would fix it. Can this be done or not?

Just tell me what to edit and where..it can't be more than a couple lines of code. ANYBODY help out here?


Let me make this simple. I want the reputation points to be divided by the post counts of members and display that quotient in their postbit.

Fireproof
06-29-2007, 07:45 AM
I think the answer and a suggestion was given. I read:

Answer: Don't do calculations in a template, but rather a PHP script.

Suggestion: Reputation system is flawed.

Unfortunately I can't help because I'm not a coder either.

I see what you are trying to do. You want to try to measure the "value add" of people's posts versus the quantity of the posts. But I still don't think it will really help too much. I have a person who is all over the board all day. Posts a lot. He DOES ADD VALUE in many of his posts (which you are saying should/would receive rep points) BUT because his total post count and activity is so high, he would score LOW in the ratio according to your system.

The other thing I don't like is that your system will promote a feeling of "don't post anything unless it's good enough to receive reps - or your score will go down." That, IMHO, will turn people into lurkers, which will reduce the "activity" on the board.

I guess it depends on what type of board you have. For mine, it would not work. People hang out for the social aspect as well as the fitness and health advice. I wouldn't want to penalize them just for posting comments to all their friends.

Dave A
06-29-2007, 11:34 PM
Thanks Fireproof - that saved me some typing.

I reckon you summed it up perfectly.

steve1971
06-30-2007, 05:24 AM
The question still remains:

Can this be done? If so, how?
(Code to paste and location)

I appreciate the input as to why this should be done or not...but I have thought this through, besides, even if I wanted to put a big yellow racing stripe across my site then it's my perogative right?

This has got to be a simple plugin..or just a modification of reputation.php

Anybody want to take a shot at this?

Dave A
06-30-2007, 06:06 AM
I'm not a coder..but apparently I should become one because there seems to be a shortage out there.
I've seen some rather frustrated people saying much the same thing recently.

I think you and I (and probably the vast majority of us) are fairly comfortable around HTML and XHTML - the challenge is php.

The template structure, being in HTML and XHTML, is really geared for layout and display. Ultimately we're placing elements generated by php. This is Paul's point - the calculation should be done in php where you'll find the tools you need to easily produce the result. And as Paul is a real coder for whom I have great respect - I'll take his word for it.

I don't know what the funtion might be in php, but what you are looking for is a round() function that is exceptionally simple to generate in an Excel formula - and I could do it in Foxbase rather easily too - but that won't help you. I can only assume that for someone well versed in php this would be dead easy too - but tossing toys out of the cot is not likely to inspire them to help.

if I wanted to put a big yellow racing stripe across my site then it's my perogative.
Of course it is. And if you pointed out here that you had done it on your forum, we have the prerogative to take the trouble to give our opinion on that too :p

Now hopefully you haven't already p'd off all the real coders that stop by here from time to time and you'll get the answer you're hoping for.

Peggy
06-30-2007, 10:08 AM
OK. So I get spammed thru e-mail to come to this site, so when I do with a legitimate hack..that should be easy as hell for VB to accomplish..and all I get is a question what I am asking for..even though I could'nt have been more detailed about my explanation...and I get told my hack is "flawed".

Reputation is flawed and this would fix it. Can this be done or not?

Just tell me what to edit and where..it can't be more than a couple lines of code. ANYBODY help out here?


Let me make this simple. I want the reputation points to be divided by the post counts of members and display that quotient in their postbit.

First, you did not get spammed through email to come here. Let's get that straight.
Second, you may have a legit hack, I don't think I've seen anyone question that. However, this isn't a community of coders, it's a vB support site. Coders drop by from time to time, yes. but asking here for a hack to be coded may or may not get you any results. If you ask at vBulletin.org where the coders DO hang out (a site full of hacks and mods) - might get you better results.

Obviously you were NOT clear about what you wanted the first time around since 4 people have had to ask you to explain in more detail. What you are asking for IS more than just a couple of lines of code, as referenced to by a coder - PaulM.

steve1971
06-30-2007, 03:03 PM
I've seen some rather frustrated people saying much the same thing recently.

I think you and I (and probably the vast majority of us) are fairly comfortable around HTML and XHTML - the challenge is php.


Yeah totally, I'm just wary about messing with php on my forum in case I create some major malfunction. I'm just frustrated because I have tried every forum there is (vb.org,.com, vb hackers, here) and no replies. I bump a thread once and that's the end of it. I also PM'd the maker of the "activity" hack because that is a similiar idea..but no reply yet.

I assumed it was an easy modification is all.

I probably have PO'd most of the coders and Paul I'm sure, so I guess its time to grab a six-pack, google php and pull an all-nighter. Maybe I can figure this out.


One question before I start trial and erroring: if I do edit say reputation.php and totally screw it up, can I just re-upload the original and everything will be ok?

Peggy
06-30-2007, 07:45 PM
Yes you can steve, just upload the original and overwrite.

Paul M
07-01-2007, 01:30 PM
No files need editing, what you want can be done via a plugin, with just a few lines and a small template change (and sorry, no, I don't have the time to write it for you atm).

steve1971
07-02-2007, 08:27 AM
The solution for this hack was already given..my appologies.

Paste in postbit template:

$post[average]


Plugin location: postbit_display_complete

if ($post['reputation'] != 0)
{
$post['average'] = vb_number_format($post['reputation'] / $post['posts'], 2);
}


User rating calculated via reputation points/post count - vBulletin.org Forum (http://www.vbulletin.org/forum/showthread.php?t=150404)

steve1971
07-02-2007, 09:34 AM
Hmmmm...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

?

Paul M
07-02-2007, 02:01 PM
Take out the vb number format function - that's for display formatting only. It will screw up any caculations.

steve1971
07-02-2007, 02:30 PM
The issue affecting the calculation is the comma that is added once a member reaches 1,000 posts.

Can I fix this?

Just saw your reply thx..what should the plugin look like then?

if ($post['reputation'] != 0)
{
$post['average'] = ($post['reputation'] / $post['posts'], 2);
}

steve1971
07-02-2007, 02:45 PM
UPDATE: the comma in 1,000 posts is causing the problem.


$post['posts'] is already run though the number formatter, you need to strip it for your personal use, or use another hook location to grab it before that happens.


Suggestions welcome on this latest development.

Paul M
07-02-2007, 02:50 PM
Actually, it's not the vbformat() in your formula that's at fault, it's the one in the class processing the posts. You need to use the postbit_display_start hook to do the calculation before the class processing screws it up. You also need to use round() on the forumula - so that line becomes $post['average'] = round($post['reputation'] / $post['posts'], 2);

Edit: Re post above - It's also not helpful (to me) running this question in two places, I get the feeling I'm wasting my time duplicating someone elses effort so I'm leaving it to them now.

steve1971
07-02-2007, 03:32 PM
Thanks Paul, for your help. I didn't mean to flood the matter, just all of a sudden help from all sides came in.


vBulletin

seo book

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum