View Single Post
  #3  
Old 12-26-2004, 09:00 PM
Watson's Avatar
Watson Watson is offline
 
Join Date: May 2004
Location: Scotland
Posts: 220
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01073 seconds
  • Memory Usage 1,796KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete