vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   User rating calculated via reputation points/post count (https://vborg.vbsupport.ru/showthread.php?t=150404)

steve71 06-22-2007 11:14 PM

User rating calculated via reputation points/post count
 
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

1 Attachment(s)
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:
Code:

<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

Code:

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

steve71 06-25-2007 06:53 AM

1 Attachment(s)
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

Code:

<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:


Quote:

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:
Code:

$post[average]
Add a plugin at 'postbit_display_complete, PHP code:
PHP Code:

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




All times are GMT. The time now is 01:11 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01225 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete