View Full Version : Display Reputation Power in postbit
Gary King
02-09-2004, 10:00 PM
This hack will display each user's reputation power in their postbit.
No extra queries run and this code doesn't really add too much extra load time, maybe only 0.0000000000000001 seconds :D
Very easy hack to install, 1 minute or less :D
Okay let's begin :)
First create a new Global phrase called reputation_power with the contentReputation Power
Now open up includes/functions_showthread.php and find
$post['joindate'] = vbdate($vboptions['registereddateformat'], $post['joindate']);
Above, add $repjoindate = $post[joindate];
Find: $show['messageicon'] = iif($post['iconpath'], true, false);
Above add $show['score'] = 1;
// reputation SECTION
// initialize reputation power
$score = 1;
// for every certain number of posts, gain a point
if ($vboptions['pcpower'])
{
$postfactor = intval($post['posts'] / $vboptions['pcpower']);
}
else
{
$postfactor = 0;
}
// for every certain number of reputation points, gain a point
if ($vboptions['kppower'])
{
$reputationfactor = intval($post['reputation'] / $vboptions['kppower']);
}
else
{
$reputationfactor = 0;
}
// for every certain number of days registered, gain a point
$timepassed = intval((TIMENOW - $repjoindate) / 86400);
if ($vboptions['rdpower'])
{
$timefactor = intval($timepassed / $vboptions['rdpower']);
}
else
{
$timefactor = 0;
}
// compute the user's total reputation power
$score = $score + $postfactor + $timefactor + $reputationfactor;
# the following only matters for admin
$perms = fetch_permissions(0, $post['userid'], $post);
if ($perms['adminpermissions'] & CANCONTROLPANEL AND $vboptions['adminpower'])
{
$score = $vboptions['adminpower'];
}
else if (($post['posts'] < $vboptions['minreputationpost']) OR ($post['reputation'] < $vboptions['minreputationcount']))
{
$score = 0;
}
#####
Now open up postbit template and find </div>
<div>$post[icqicon] $post[aimicon] $post[msnicon] $post[yahooicon]</div>
Above add <if condition="$show[score]"><br />$vbphrase[reputation_power]: $score</if>
All done :D
Milez
02-10-2004, 08:40 PM
Wow and no extra queries or serious overhead! Thanks a ton Gary!
Gary King
02-10-2004, 08:46 PM
No problemo :)
drumsy
02-11-2004, 12:32 AM
How will this look? Any screenshots?
Gary King
02-11-2004, 12:41 AM
One moment :)
Gary King
02-11-2004, 12:43 AM
Attached to first post ;)
achtungbaby
02-11-2004, 02:10 AM
I like it:)
*edit* - umm, it doesn't look like it's calculating the rep power properly.
Some users (like the admins) are being calculated correctly...others, no.
Milez
02-11-2004, 01:14 PM
Strange! I did everything properly and have triple checked your script. I keep getting incorrect score values showing up. They do not match what is shown in the admincp. Even stranger the scores are always in the 400's. The values are always: 416, 417, 418, 419, etc. Really strange.
Did you notice the phrase name: current_reputation_power ? Maybe that helps...
Let me know if you have a solution...This is a live board so I better unhack what I did here ;)
MrNase
02-11-2004, 04:56 PM
What does Reputation Power show? The 'points' instead of the grafics?
Milez
02-11-2004, 06:37 PM
There are 2 variables concerning reputation. Rep points and Rep power. The images are showing rep points. I want to show Rep power as well.
Gary King
02-11-2004, 08:36 PM
There are 2 variables concerning reputation. Rep points and Rep power. The images are showing rep points. I want to show Rep power as well.
Yeah the screenshot shows reputation power. I'm working on fixing it for all users instead of only working for administrators right now :)
Gary King
02-11-2004, 09:06 PM
Okay problem fixed now, I'm just updating instructions :)
Gary King
02-11-2004, 09:09 PM
Please update the hack on your forums to get this working properly :D
Milez
02-11-2004, 09:39 PM
Argh...
Works for regular user, admins, and moderators, but not for members in the other special user group I created. They show a score of: 0. Any ideas??
Your soooo close! Thanks again :)
Milez
02-11-2004, 09:45 PM
Even stranger. After looking around I see that its only 'some' member of that group that get 0. Others have proper scores. I'm still looking...
Milez
02-11-2004, 09:58 PM
crazy! I have no clue what is causing this. I thought that maybe it was users with show rep set to NO but that is not it either. No idea why certain user's in my created groups are showing scores of 0. It's only a few too. Like maybe 20% of them.
I would show you but the board is live and I had to turn it off to install this...
Gary King
02-11-2004, 10:02 PM
I'll look into this when I have the chance but thanks for the bug reports guys :D
Milez
02-11-2004, 10:14 PM
I see one of my users in the 'moderators' group also has a 0 rating.
UPDATE: My mistake this user is in the group I created. Disregard.
Gary King
02-11-2004, 11:04 PM
crazy! I have no clue what is causing this. I thought that maybe it was users with show rep set to NO but that is not it either. No idea why certain user's in my created groups are showing scores of 0. It's only a few too. Like maybe 20% of them.
I would show you but the board is live and I had to turn it off to install this...
Can't you turn back on?
Gary King
02-11-2004, 11:06 PM
Strange I tried using a user from a usergroup that I created, but it looks fine to me.
Milez
02-11-2004, 11:14 PM
Its on. Take a look if you can...
I have only found 4 or 5 users that get the 0 power level. From looking at their profiles I still cannot see anything different that would set them apart. Totally wierd.
In the admincp they have proper power ratings...I swear to god!
Gary King
02-11-2004, 11:50 PM
Its on. Take a look if you can...
I have only found 4 or 5 users that get the 0 power level. From looking at their profiles I still cannot see anything different that would set them apart. Totally wierd.
In the admincp they have proper power ratings...I swear to god!
Then that's even stranger, if there is no pattern with the ones with 0 power level. Does it show 0 power level for them in all their posts?
Milez
02-12-2004, 12:04 AM
Yes. I'm still looking and don't see what it could possibly be. Some of the users affected are old members some are new. Seems to be no pattern and I even changed some of their user options that would effect this, ie: post count, joindate, rep score. Very bizarre.
Did you manage to get on my forum and see the problem for yourself? I made you an account and PM'ed the details.
Gary King
02-12-2004, 12:45 AM
Yes. I'm still looking and don't see what it could possibly be. Some of the users affected are old members some are new. Seems to be no pattern and I even changed some of their user options that would effect this, ie: post count, joindate, rep score. Very bizarre.
Did you manage to get on my forum and see the problem for yourself? I made you an account and PM'ed the details.
It looks strange, I mean there is no (obvious) pattern. Possibly additional usergroups, etc. affecting it? Strange, very strange indeed :confused:
Milez
02-12-2004, 12:55 AM
No additional user groups. I will keep looking.
I have also found a second bug. When you look at your private messages the Repuation Power text does not show up. I will attach an image so you can see what I mean.
Gary King
02-12-2004, 12:57 AM
No additional user groups. I will keep looking.
I have also found a second bug. When you look at your private messages the Repuation Power text does not show up. I will attach an image so you can see what I mean.
Change the new phrase type from Show Thread to Global type :)
Milez
02-12-2004, 01:02 AM
Nice :)
Milez
02-12-2004, 03:17 AM
Wow I still have no idea what could be causing the 0 to show up under some (4) users Rep Power scores. Seems to be only these 4 users in the group I created. It's baffling because in the admincp the proper score is displayed. I have gone into the database and compared 2 users: 1 who is working peoperly and 1 who isn't. I don't see any clues or indicators as to what it could be.
rinkrat
02-12-2004, 03:59 AM
You might have it set so that a user has to post 50 messages to have their power work and they have less than 50 posts. I'm pretty sure it's something like this. Check your Reputation settings.
Milez
02-12-2004, 11:09 AM
Nope. The users affected have 1500 posts.
Milez
02-12-2004, 02:20 PM
Tried moving the affected users to another usergroup but still they show Rep Power: 0.
Anyone out there installed this on a busy board with alot of members and have no troubles at all?
Milez
02-13-2004, 02:27 PM
Gary: Perhaps since only 3 users seem to be affected I should recreate their user accounts? Not sure how to do this without them losing their posts though which is not good. Any advice?
You can for yourself the problem with the 0 Rep Power score with the user account I created for you on my board. I pm'ed you the info so not sure if you saw it or not.
Gary King
02-13-2004, 02:41 PM
Gary: Perhaps since only 3 users seem to be affected I should recreate their user accounts? Not sure how to do this without them losing their posts though which is not good. Any advice?
You can for yourself the problem with the 0 Rep Power score with the user account I created for you on my board. I pm'ed you the info so not sure if you saw it or not.
Yeah I saw, and it's really strange; unless I receive confirmation from someone else about this problem though I think I'll leave it for now, especially since I've been real busy these days :ermm:
trilOByte
02-15-2004, 01:34 PM
Followed your intstructions on page 1 and all mods/supermods/admins show 0. Regular members show correctly, as do members of a custom user group.
See:
http://www.britishblades.com/forums/showthread.php?t=1996&page=1&pp=20
The template edit is on the "vB3 grey style" skin only, so make sure you have that selected.
Gary King
02-15-2004, 02:37 PM
Followed your intstructions on page 1 and all mods/supermods/admins show 0. Regular members show correctly, as do members of a custom user group.
See:
http://www.britishblades.com/forums/showthread.php?t=1996&page=1&pp=20
The template edit is on the "vB3 grey style" skin only, so make sure you have that selected.
Make sure that they actually don't have 0 reputation power before jumping to conclusions because I believe that admins are different in that their reputation power stays the same, etc. I'm not too sure on the specifics, but maybe check first to see if the user has 0 reputation power; also please make a screenshot would make life easier for me :) (in the admin cp when editing the user.)
trilOByte
02-15-2004, 03:31 PM
No mistake. My power is currently 6, it displays as 0. I checked several mods/admins to make sure they had power, they did, it was displaying 0. If you browse the thread linked above, notice the different user groups have their names in different colours.
There is no mistake.
Correction *some* mods show the power rating also some members of other user groups do not. It would appear to be random, although it does not show for any of the 3 admins, and is missing of all but 1 of the moderators.
On an aside, I manually set the power rating in the ACP to 10 for admins - the hack then showed this value (for admins only, the mods still had 0 showing). I then reset it to 0 in the ACP (this should set admins to the same rules as everyone else) and the admins showed as 0 in the postbit - even though the ACP correctly showed my power as 6.
Milez
02-16-2004, 12:29 AM
I have similiar issues that Gary is aware of.
As a side note I have also noticed that none of my users in my created group show having incorrect values. Some as I have mentioned are 0 yet some are showing values slightly off from what is shown in the admincp.
Anyways there is definately something wrong. I think I will have to uninstall this hack until someone comes up with a solution to fix this - I have spent dozens of hours trying to figure out what it could be.
As a side note: I recreated an account for one of the affected users and merged his existing account with the new one. After doing this the rep power didn't display zero but it did display a value that was incorrect from what is shown in the admincp.
has anyone else with a large board tested this code? Can a vb dev member shed some light as to what it could be?
trilOByte
02-16-2004, 02:33 AM
The power=0 issue seems random. I get it accross all user groups, regardless of actual power rating. Some read correctly, some just say 0. So far, I havent found a member with a value other than 0, which is also incorrect.
Gary King
02-16-2004, 11:06 AM
Strange that's real weird, I posted a question at vB.com about this hopefully I get a response :)
Milez
02-16-2004, 02:37 PM
Hehe so did I Gary. Thanks for your attention.
trilOByte
02-26-2004, 01:05 AM
Any news guys?
Milez
03-30-2004, 08:18 AM
Please say someone knows how to do this by now?? :ermm:
Frank
03-30-2004, 11:47 PM
Lookin forward to trying this hack out when the problems are fixed :D
Shouldn't this go back to beta hacks forum?
mAdMASterP
04-06-2004, 06:30 PM
Hi. I tried following your instructions, but the problem with my forum (vb 3.0) is that it doesnt show any record of the reputation power (points?).
I put the if-line into the postbit, I even put as "$vbphrase[reputation_power]: $score" into the postbit_reputation template. I'm using the german version of the vBulletin, but I think the problem should encounter because of that. Right now my vB3 install is just a tiny testboard of 5 members and about 30 postings.
I'm noticing the same things!
TJFweb
05-03-2004, 02:28 AM
Yes, I have a few users displaying 0 power when they should have more...
JagFan
05-09-2004, 04:34 PM
I installed this and had the same issues with the incorrect power showing...I uninstalled and will watch this thread b/c I really like this one :)
Milez
05-10-2004, 01:11 AM
Anyone?? This seems so rudimentary at this point with VB Gold 3 released, yet I cannot make it work.
TJFweb
05-10-2004, 08:41 AM
I have no idea why it is not calculating for 2 or 3 of my users... Does anyone know why? The code's quite simple, surely someone familiar with vB modding would be able to see any errors?
Thanatos
05-17-2004, 12:41 AM
Suffering the same problem with 0 rep power for some members, but not others. Seems random.
TJFweb
05-17-2004, 03:23 AM
I wish someone could work out why this is happening. Any news of reputation enhancements in the next vBulletin?
apokphp
05-17-2004, 07:12 PM
Why is this thread in "Full Release" status? Shouldn't this be "beta"? 100% of the posters here have the exact same error with the hack.
I do hope it gets solved, it is what I'm looking to use for my own board.
dutchbb
06-12-2004, 02:19 PM
shows 0 for some members that have more then 0 power?
LewZer
06-19-2004, 10:11 AM
Is the problem with users who has more than 1000 posts?
Try this fix:
$show['score'] = 1;
// reputation SECTION
// initialize reputation power
$score = 1;
// for every certain number of posts, gain a point
if ($vboptions['pcpower'])
{
$postfactor = intval(str_replace($bbuserinfo['lang_thousandsep'], '', $user['posts']) / $vboptions['pcpower']);
}
else
{
$postfactor = 0;
}
// for every certain number of reputation points, gain a point
if ($vboptions['kppower'])
{
$reputationfactor = intval($post['reputation'] / $vboptions['kppower']);
}
else
{
$reputationfactor = 0;
}
// for every certain number of days registered, gain a point
$timepassed = intval((TIMENOW - $repjoindate) / 86400);
if ($vboptions['rdpower'])
{
$timefactor = intval($timepassed / $vboptions['rdpower']);
}
else
{
$timefactor = 0;
}
// compute the user's total reputation power
$score = $score + $postfactor + $timefactor + $reputationfactor;
# the following only matters for admin
$perms = fetch_permissions(0, $post['userid'], $post);
if ($perms['adminpermissions'] & CANCONTROLPANEL AND $vboptions['adminpower'])
{
$score = $vboptions['adminpower'];
}
else if ((str_replace($bbuserinfo['lang_thousandsep'], '', $user['posts']) < $vboptions['minreputationpost']) OR ($post['reputation'] < $vboptions['minreputationcount']))
{
$score = 0;
}
#####
The Realist
06-20-2004, 01:01 PM
Dont show up at all on my forums.
hambil
06-27-2004, 05:08 AM
You where onto something, but you didn't take it far enough. Here is the fix:
Find:
$post['posts'] = vb_number_format($post['posts']);
Add above:
global $rawposts;
$rawposts = $post['posts'];
Modify reputation power section as follows:
$show['score'] = 1;
// reputation SECTION
// initialize reputation power
$score = 1;
// for every certain number of posts, gain a point
if ($vboptions['pcpower'])
{
$postfactor = intval($rawposts / $vboptions['pcpower']);
}
else
{
$postfactor = 0;
}
// for every certain number of reputation points, gain a point
if ($vboptions['kppower'])
{
$reputationfactor = intval($post['reputation'] / $vboptions['kppower']);
}
else
{
$reputationfactor = 0;
}
// for every certain number of days registered, gain a point
$timepassed = intval((TIMENOW - $repjoindate) / 86400);
if ($vboptions['rdpower'])
{
$timefactor = intval($timepassed / $vboptions['rdpower']);
}
else
{
$timefactor = 0;
}
// compute the user's total reputation power
$score = $score + $postfactor + $timefactor + $reputationfactor;
# the following only matters for admin
$perms = fetch_permissions(0, $post['userid'], $post);
if ($perms['adminpermissions'] & CANCONTROLPANEL AND $vboptions['adminpower'])
{
$score = $vboptions['adminpower'];
}
else if (($rawposts < $vboptions['minreputationpost']) OR ($post['reputation'] < $vboptions['minreputationcount']))
{
$score = 0;
}
That works for me. Good luck.
Taco John
07-17-2004, 08:57 AM
Dont show up at all on my forums.
Same for me... I followed the instructions twice, to the T...
I'm getting nuttin'.
nonet
07-17-2004, 01:49 PM
Very cool! It works great, however, I wound up with an extra space above the reputation power. Where do I edit the code to remove it?
Sir_Yaro
07-17-2004, 03:13 PM
nice!
*install*
You where onto something, but you didn't take it far enough. Here is the fix:
[...]
its work! :D :D
theArchitect
09-16-2004, 12:19 AM
Great hack *clicks install*.
I have combined this with "show numerical reputation points" (the green dots are neat, but my users wanted a numerical value too). Only problem is if my users choose to turn their rep visibility off, the little green dots go to black but the rep power & number still shows up.
Any thoughts on how I get these to vanish too?
TJFweb
09-22-2004, 03:11 AM
You where onto something, but you didn't take it far enough. Here is the fix:
Find:
$post['posts'] = vb_number_format($post['posts']);
Add above:
global $rawposts;
$rawposts = $post['posts'];
Modify reputation power section as follows:
$show['score'] = 1;
// reputation SECTION
// initialize reputation power
$score = 1;
// for every certain number of posts, gain a point
if ($vboptions['pcpower'])
{
$postfactor = intval($rawposts / $vboptions['pcpower']);
}
else
{
$postfactor = 0;
}
// for every certain number of reputation points, gain a point
if ($vboptions['kppower'])
{
$reputationfactor = intval($post['reputation'] / $vboptions['kppower']);
}
else
{
$reputationfactor = 0;
}
// for every certain number of days registered, gain a point
$timepassed = intval((TIMENOW - $repjoindate) / 86400);
if ($vboptions['rdpower'])
{
$timefactor = intval($timepassed / $vboptions['rdpower']);
}
else
{
$timefactor = 0;
}
// compute the user's total reputation power
$score = $score + $postfactor + $timefactor + $reputationfactor;
# the following only matters for admin
$perms = fetch_permissions(0, $post['userid'], $post);
if ($perms['adminpermissions'] & CANCONTROLPANEL AND $vboptions['adminpower'])
{
$score = $vboptions['adminpower'];
}
else if (($rawposts < $vboptions['minreputationpost']) OR ($post['reputation'] < $vboptions['minreputationcount']))
{
$score = 0;
}
That works for me. Good luck.
It actually work well now. Actually it works extremely well. Thanks for fixing it hambil!
Guys, I think I found a MUCH simpler way to do this. I assumed there was a function in vB to compute the reputation power, and there is. Why not use this function?
In functions_reputation.php
Find (line 81):
$reputation_value = $post['reputation'];
Immediately after, ADD:
$reputation_power = fetch_reppower($post, $perms);
$post['reputationpower'] = $reputation_power;
Now, you can use $post[reputationpower] the same way you can use $post[reputation] in your postbit template...
So far this is working great... What am I missing that this wasn't built-in function used before?
Just adding a verification, full day with this change, no issues...
Takamine334
10-10-2004, 12:07 AM
if I've installed the way the first post says to, am I supposed to update anything. I've read the thread and several people say to change several things.
if I've installed the way the first post says to, am I supposed to update anything. I've read the thread and several people say to change several things.
My change is a complete replacement of the first post. I was hoping somone could validate it, so I knew I wasn't just being crazy...then I'd post it as a completely different mod.
kisersose
01-04-2005, 03:16 AM
excellent... thanx
yoyoyoyo
01-10-2005, 02:36 PM
Now, you can use $post[reputationpower] the same way you can use $post[reputation] in your postbit template...
can you be a little more specific? Where should I put $post[reputation] in order for it to show in the postbit?
can you be a little more specific? Where should I put $post[reputation] in order for it to show in the postbit?
I put mine in the "alt' tag of the reputation image:
...alt="$post[reputation]/$post[reputationpower]"...
looks like: 100/10 on mouseover.
Big Kahuna
01-28-2005, 03:42 PM
Installed at www.moparstyle.com and popular
Big Kahuna
01-30-2005, 02:51 PM
Little problem (I installed the way it is in the first post of the thread)
I have some (small percentage that I can tell) members that display zero -- but when I go in and look at their profile in Admincp -- they'll have a power of say 6. One member PM'd me screaming his power was zero and what had he done -- then pm'd be that it now shows 6. I look at his post and it shows zero -- but when I look at his profile in admncp -- it is 6.
Obviously -- those are the ones screaming conspiracy. How can I fix this?
nintendo
01-31-2005, 08:37 AM
You should make a completly new thread with that much smaller method. Then we can give you an 'Install' click.
face0fdie
04-21-2005, 10:12 AM
So sorry but i use Use Legacy (Vertical) Postbit Template and in my template when i use Use Legacy (Vertical) Postbit Template dot show this
what can i do to fix this problem
thanks
akulion
01-29-2007, 05:02 AM
hi
using the edit that Dune gave but there is a slight problem
Anytime someone reps someone the rep points/power display dissapears until the page reloads
I added it like this
Rep Power:
Rep:
so the template edits were in post bit legacy near where the rep is displayed
any idea how to fix it?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.