MyBB Hacks

Full Version: Displaying Plus sign (+) before positive rep points
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been asking about this on MyBB but have gotten nowhere with it, read this post first: Putting + sign in-front of positive reps.

What I'm trying to do there seemed pretty straight forward to me, edit the reputation.php file and change this code below to put two + sign in the same places were (- signs) are displayed for negative points in the code below it. Not the case though!

Quote: $positive_title = $lang->sprintf($lang->power_positive, "+".$i);
$positive_power = "\t\t\t\t\t<option value=\"{$i}\" class=\"reputation_positive\" onclick=\"$('reputation').className='reputation_positive'\"{$vote_check[$i]}>{$positive_title}</option>\n".$positive_power;
if($mybb->settings['negrep'])
{

Two + signs added below (in red), but made no difference.

Quote: $positive_title = $lang->sprintf($lang->power_positive, "+".$i);
$positive_power = "\t\t\t\t\t<option value=\"+{$i}\" class=\"reputation_positive\" onclick=\"$('reputation').className='reputation_positive'\"{$vote_check[+$i]}>{$positive_title}</option>\n".$positive_power;
if($mybb->settings['negrep'])
{

My question, how can you make it so plus points displays a + sign in-front of rep points. I've tried lot of ways now, only using one + sign in each place, rather than 2 added. Still no joy though! Surely it can be that hard to show a + sign in-front of positive reps numbers.
You can try this way:

functions.php, find (by default, MyBB 1.6*, it's in line #2738):

PHP Code:
elseif($reputation > 0)
{
	$display_reputation .= "reputation_positive";
}


replace it with:

PHP Code:
elseif($reputation > 0)
{
	$display_reputation .= "reputation_positive";
	$reputation = '+'.$reputation;
}

Alternatively, if it's not possible to display the + sign in-front of Positve reps points. Is the a way instead to remove the - sign from being displayed in-front of negative points. That's another option I'm willing to go with as well? So you would see a red number with no - sign displayed.
(07-05-2011 01:59 AM)RateU Wrote: [ -> ]You can try this way:

functions.php, find (by default, MyBB 1.6*, it's in line #2738):

PHP Code:
elseif($reputation > 0)
{
	$display_reputation .= "reputation_positive";
}


replace it with:

PHP Code:
elseif($reputation > 0)
{
	$display_reputation .= "reputation_positive";
	$reputation = '+'.$reputation;
}


Thanks for that, it works fine displaying the + sign in profile fields on the forum in posts. But when you go to the REP page where comments are left the + sign does not get displayed there like it does if you have minus REP. Pictures uploaded to show what I mean.

But it works fine on testing, just now needs to get a + sign displayed there also and jobs a good one.
If you have Template Conditionals or PHP in Templates / Complex Templates plugin, you can try to do that via template edit:

reputation template, find:

Code:
{$user['reputation']}


Replace it with:

Code:
<if $user['reputation'] > 0 then>+</if>{$user['reputation']}


Or, if you want to do that via a core edit, you can try this:
reputation.php file, find:

PHP Code:
if(!$user['reputation'])
{
	$user['reputation'] = 0;
}


Replace it with:

PHP Code:
if(!$user['reputation'])
{
	$user['reputation'] = 0;
}elseif($user['reputation'] > 0){
	$user['reputation'] = '+'.$user['reputation'];
}

I've done lots of core file edits already to add borders and such around avatars, plus I don't use that hack permission in templates. I've gone the way of core editing and it works perfect, image below to show.

Thanks very much for your help and being fast doing it too. I'll update that thread on MyBB now and point in direction of this thread here to help others looking how to do the same thing.

Again, thanks! Much appreciated.
Glad you can solve the problem Smile
Reference URL's