![]() |
Reputation Divided by Post Count Displayed as %
I'm looking for someone who can help me with something. I want to be able to divide my users reputation by their post count, derive a % from it, and display it in each users postbit. I'd like to call it "Tip Ratio". This is necessary for our forum, but I can't quite figure out how to do it. Example to derive the "Tip Ratio":
Reputation: 206 Join Date: Mar 2011 Posts: 1,064 Tip Ratio: 19.4% (where 206/1064) Anyone interested in taking this on? |
A great coder took care of me. I appreciate it!
|
someone else want to post how this was done?
|
Maybe something like this: create a plugin using hook location postbit_display_complete and code like:
Code:
if ($post['posts'] > 0) Then use {vb:raw post.tip_ratio} in your postbit or postbit_legacy template. |
Quote:
ie, a user with 109 posts and 7 rep got a "0.1" how would i get the number to display as "6.4%"? |
Yeah, that happens a lot when I post code I didn't test. I think maybe it needs a "* 100" before the comma in the vb_number_format line (sorry, I would post the code but i'm using my pad and it's too hard to enter all that).
|
nah, that just multiplied the weird number by 100
ie, user with 170 rep and 1,739 posts gets "17,000.0" rep/posts should be 0.097, or if multiplied by 100 to get that % figure, 9.7% i tried for testing purposes: Quote:
Quote:
|
Try this:
Code:
if ($post['posts'] > 0) |
This is the code kh99 gave me to get the Tip Ratio for times thanked divided by their post count and it works perfect.
I figure you just replace post_thanks_thanked_times with reputation here right? Hope this works, as I was getting the same type of output as you were until kh99 figured it out. Code:
if ($post['posts'] > 0) So yes, the code I posted worked for me so it should be working for you too The Mailman ... |
Quote:
|
All times are GMT. The time now is 03:10 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|