vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Display Reputation Power in postbit (https://vborg.vbsupport.ru/showthread.php?t=61408)

Gary King 02-09-2004 10:00 PM

Display Reputation Power in postbit
 
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 content
Code:

Reputation Power
Now open up includes/functions_showthread.php and find

PHP Code:

        $post['joindate'] = vbdate($vboptions['registereddateformat'], $post['joindate']); 

Above, add
PHP Code:

        $repjoindate $post[joindate]; 

Find:
PHP Code:

    $show['messageicon'] = iif($post['iconpath'], truefalse); 

Above add
PHP Code:

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

                                        </div>
                                        <div>$post[icqicon] $post[aimicon] $post[msnicon] $post[yahooicon]</div>

Above add
HTML Code:

                                                <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

Quote:

Originally Posted by Milez
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

Quote:

Originally Posted by Milez
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

Quote:

Originally Posted by Milez
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

Quote:

Originally Posted by Milez
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

Quote:

Originally Posted by Milez
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

Quote:

Originally Posted by Milez
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/...6&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

Quote:

Originally Posted by trilOByte
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/...6&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.


All times are GMT. The time now is 04:46 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.01437 seconds
  • Memory Usage 1,847KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_html_printable
  • (4)bbcode_php_printable
  • (7)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
  • (40)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