Log in

View Full Version : Reputation Modification


Watson
12-26-2004, 04:57 PM
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/showthread.php?s=&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


--------------------------------------
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
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 mateSure, 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.


// ###################### 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

Paul M
11-01-2005, 08:53 AM
The hack was ported to 3.5 as "Extended Reputation Display".

Watson
11-02-2005, 10:29 AM
Thanks for that Paul, and again, thanks for the original hack :)

Chicago_VLNU_4s
10-27-2006, 06:56 AM
wish i could say the same. I need something done like this, different pips and ranking, but same request. I tried to follow your instructions paul, and no go. The pip field doesn't even show up anymore :/