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.


All times are GMT. The time now is 12:32 AM.

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.01095 seconds
  • Memory Usage 1,753KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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