vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Reputation Modification (https://vborg.vbsupport.ru/showthread.php?t=73326)

Watson 12-26-2004 04:57 PM

Reputation Modification
 
Is there any way I am able to reduce the amount of reputation that is displayed.

I used to have it displayed Numerically, but I went back to the basic system, except I now use stars instead of Blobs.

But the stars are rather big, but I do like them.

What I am looking for is how I would edit when a new star is added to someones rep, so I can have it like 1000 = 1 Star, 2000 = 2 Stars and so on

Cheers

Watson

Paul M 12-26-2004 05:04 PM

Try this ;

https://vborg.vbsupport.ru/showthrea...threadid=69836

Just adapt it to display your stars instead of the gree/gold pips, and alter the default display values as required for your 1000 = 1 etc.

Watson 12-26-2004 09:00 PM

Looks like this could work well mate, but I aint sure what would be the best to take out of there, so it just works with the 1 image that I have

Code:

--------------------------------------
Reputation 'Pips' Display Enhancement.
--------------------------------------

This extends the existing reputation display system into three flexible bands ;

The existing dark green and light green pips, followed by 'gold' pips.
The number and value of the pips in each band is defined by six variables in the code.


For each band a, b or c - 'band_x_val' is the vaulue of each pip and 'band_x_count' is the number displayed before moving onto the next level.


The defaults make the first 5 pips value 100, followed by 5 pips worth 200, followed by gold pips worth 1000 (max 10).

i.e.

1 - 100 = 1 Dark green
101 - 200 = 2 Dark green
401 - 500 = 5 Dark green

501 - 700 = 5 Dark green, 1 Light green
701 - 900 = 5 Dark green, 2 Light green
501 - 1500 = 5 Dark green, 5 Light green

1501 - 2500 = 5 Dark green, 5 Light green, 1 Gold
2501 - 3500 = 5 Dark green, 5 Light green, 2 Gold

10501 - onwards = 5 Dark green, 5 Light green, 10 Gold


Negative reputations are similarly displayed, except there is no gold.

If your reputation is zero then the neutral grey pip is displayed.


 ##### v1.1 ##### ;


Added code for undefined reputaion level description.

Added code for people whose reputation is disabled - they will display a crossed icon (new 'off' gif included in zip).




##################
## Instructions ##
##################


Step 1 ;

In functions_reputation.php

Find ;


// ###################### Start getreputationimage #######################

<current block of code>

/*======================================================================*\
|| ####################################################################



Replace the whole block of code with this ;


// ###################### Start getreputationimage #######################
// ###################### Start Reputation Image Hack - Paul Marsden v1.1 #######################
function fetch_reputation_image(&$post, &$perms)
{
        global $vboptions, $stylevar, $vbphrase;

        $band_a_val = 100;
        $band_a_count = 5;

        $band_b_val = 200;
        $band_b_count = 5;

        $band_c_val = 1000;
        $band_c_count = 10;

//  For each band 'band_x_val' is the vaulue of each pip and 'band_x_count' is the number displayed before moving onto the next level. 

        if (!$vboptions['reputationenable'])
        {
                return true;
        }

        if (!$post['reputationlevelid'])
        {
                $post['level'] = $vboptions['reputationundefined'];
        }

        if (!$post['showreputation'] AND $perms['genericpermissions'] & CANHIDEREP)
        {
                        $posneg = 'off';
                        $post['level'] = $vbphrase['reputation_disabled'];
                        eval('$post[\'reputationdisplay\'] .= "' . fetch_template('postbit_reputation') . '";');
        }
        else
        {

                $repval = $post['reputation'];       

                if ($repval == 0)
                {
                        $posneg = 'grey';
                        eval('$post[\'reputationdisplay\'] .= "' . fetch_template('postbit_reputation') . '";');
                }
                else if ($post['reputation'] < 0)
                {
                        $repa = 'red';
                        $repb = 'redh';
                        $repc = 'redh';
                        $repval = $repval * -1;
                }
                else
                {
                        $repa = 'green';
                        $repb = 'greenh';
                        $repc = 'gold';
                }

                $count = $band_a_count;
                while ($count > 0 and $repval > 0) {
                        $count -= 1;
                        $repval -= $band_a_val;
                        $posneg = $repa;
                        eval('$post[\'reputationdisplay\'] .= "' . fetch_template('postbit_reputation') . '";');
                }

                $count = $band_b_count;
                while ($count > 0 and $repval > 0) {
                        $count -= 1;
                        $repval -= $band_b_val;
                        $posneg = $repb;
                        eval('$post[\'reputationdisplay\'] .= "' . fetch_template('postbit_reputation') . '";');
                }

                $count = $band_c_count;
                while ($count > 0 and $repval > 0) {
                        $count -= 1;
                        $repval -= $band_c_val;
                        $posneg = $repc;
                        eval('$post[\'reputationdisplay\'] .= "' . fetch_template('postbit_reputation') . '";');
                }
        }
        return true;
}


/*======================================================================*\
|| ####################################################################



Step 2 ;

Copy the six gif images into your /images/reputation folder.



That's it, enjoy

Paul.

I aint really got a scooby what I would edit to allow for me to change the amount of rep points, and also what I would take out so that it works with my stars. Any help with the file would be magic mate

Watson

Paul M 12-26-2004 09:51 PM

Quote:

Originally Posted by Watson
I aint really got a scooby what I would edit to allow for me to change the amount of rep points, and also what I would take out so that it works with my stars. Any help with the file would be magic mate

Sure, but a few questions first.

1. What is the name of you star image file (star.gif ?)

2. What do you actually want to display - e.g. 0 - 750 = 1 star, 751 - 1500 = 2 stars etc

3. At what point do you want to stop (3 stars, 5 stars, 10 stars, or some other value ?)

4. What do you want to display for negative reputations ?

The answers to these will determine what settings to alter in the hack. :)

Watson 12-27-2004 08:28 PM

1. they are just named the default name of the reputation blobs, cause I didnt know how too change them, so I can change the star name to anything that you name it, as long as its in the folder. Cause my files are named like

reputation_pos.gif
reputation_high.gif

And its the same image :/

2. 1 Star = 0-500
2 Star = 501-1000
3 Star = 1001 - 2500
4 Star = 2501 - 5000
5 Star = 5001 - 10000
6 Star = 10001 +

3. I would like it to stop at 6 Stars mate

4. I would like to display summit else for negative rep, i.e. a piece of poo or summit (heh) so if you just tell me what to name the file and where to put it, then I can do that too.

Thanks very mucho mate

Watson

Paul M 12-28-2004 12:22 AM

use the following.

I have marked the relevant values in red.

Code:

// ###################### Start Reputation Image Hack - Paul Marsden v1.1 #######################
function fetch_reputation_image(&$post, &$perms)
{
        global $vboptions, $stylevar, $vbphrase;

        $band_a_val = 500;
        $band_a_count = 2;

        $band_b_val = 2000;
        $band_b_count = 2;

        $band_c_val = 5000;
        $band_c_count = 2;

//  For each band 'band_x_val' is the vaulue of each pip and 'band_x_count' is the number displayed before moving onto the next level. 

        if (!$vboptions['reputationenable'])
        {
                return true;
        }

        if (!$post['reputationlevelid'])
        {
                $post['level'] = $vboptions['reputationundefined'];
        }

        if (!$post['showreputation'] AND $perms['genericpermissions'] & CANHIDEREP)
        {
                        $posneg = 'off';
                        $post['level'] = $vbphrase['reputation_disabled'];
                        eval('$post[\'reputationdisplay\'] .= "' . fetch_template('postbit_reputation') . '";');
        }
        else
        {

                $repval = $post['reputation'];       

                if ($repval == 0)
                {
                        $posneg = 'zero';
                        eval('$post[\'reputationdisplay\'] .= "' . fetch_template('postbit_reputation') . '";');
                }
                else if ($post['reputation'] < 0)
                {
                        $repa = 'poo';
                        $repb = 'poo';
                        $repc = 'poo';
                        $repval = $repval * -1;
                }
                else
                {
                        $repa = 'star';
                        $repb = 'star';
                        $repc = 'star';
                }

                $count = $band_a_count;
                while ($count > 0 and $repval > 0) {
                        $count -= 1;
                        $repval -= $band_a_val;
                        $posneg = $repa;
                        eval('$post[\'reputationdisplay\'] .= "' . fetch_template('postbit_reputation') . '";');
                }

                $count = $band_b_count;
                while ($count > 0 and $repval > 0) {
                        $count -= 1;
                        $repval -= $band_b_val;
                        $posneg = $repb;
                        eval('$post[\'reputationdisplay\'] .= "' . fetch_template('postbit_reputation') . '";');
                }

                $count = $band_c_count;
                while ($count > 0 and $repval > 0) {
                        $count -= 1;
                        $repval -= $band_c_val;
                        $posneg = $repc;
                        eval('$post[\'reputationdisplay\'] .= "' . fetch_template('postbit_reputation') . '";');
                }
        }
        return true;
}

You need four image files ;

star.gif = Positive rep image.
poo.gif = Negative rep image.
zero.gif = Image when rep is exactly zero.
off.gif = Image if rep display is disabled.

This will give you the closest possible to what you want - you will get ;

1 Star = 0-500
2 Star = 501-1000
3 Star = 1001 - 3000
4 Star = 3001 - 5000
5 Star = 5001 - 10000
6 Star = 10001 +

No more than 6 stars.

Negative scores will work exactly the same, but display poo.gif

:)

Watson 12-28-2004 05:00 PM

ok works mate, however the images aint showing up for some reason

Watson 12-28-2004 05:06 PM

Its ok actually mate, I had to put reputation_ before the image names. Thanks very much for this

Paul M 12-28-2004 05:45 PM

Your postbit_reputation template must be adding that prefix, glad you sorted it. :)

Watson 11-01-2005 08:34 AM

I am wondering if anyone is able to port this over to 3.5 for me. Or if it will work anyway?

Any help would be mucho appreciated

Regards

Watson


All times are GMT. The time now is 06:49 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.01028 seconds
  • Memory Usage 1,791KB
  • 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
  • (2)bbcode_code_printable
  • (1)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
  • (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