Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-22-2007, 11:14 PM
steve71 steve71 is offline
 
Join Date: Dec 2006
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 06-23-2007, 04:08 PM
steve71 steve71 is offline
 
Join Date: Dec 2006
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)
Attached Images
File Type: gif average.gif (1.5 KB, 0 views)
Reply With Quote
  #3  
Old 06-23-2007, 11:14 PM
steve71 steve71 is offline
 
Join Date: Dec 2006
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$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?
Reply With Quote
  #4  
Old 06-24-2007, 06:05 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use this in the template:
Code:
<if condition="$post[average] = $post[reputation] / $post[posts]">$post[average]</if>
Reply With Quote
  #5  
Old 06-24-2007, 06:26 AM
steve71 steve71 is offline
 
Join Date: Dec 2006
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)
Reply With Quote
  #6  
Old 06-25-2007, 06:37 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
<if condition="$post[reputation] != 0"><if condition="$post[average] = $post[reputation] / $post[posts]">$post[average]</if></if>
Reply With Quote
  #7  
Old 06-25-2007, 06:53 AM
steve71 steve71 is offline
 
Join Date: Dec 2006
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Attached Images
File Type: gif rate.gif (8.8 KB, 0 views)
Reply With Quote
  #8  
Old 06-25-2007, 11:37 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
<if condition="$post[reputation] != 0"><if condition="$post[average] = vb_number_format($post[reputation] / $post[posts], 2)">$post[average]</if></if>
Reply With Quote
  #9  
Old 06-25-2007, 01:14 PM
steve71 steve71 is offline
 
Join Date: Dec 2006
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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()
Reply With Quote
  #10  
Old 06-26-2007, 07:40 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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);

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:17 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08012 seconds
  • Memory Usage 2,280KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete