Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I get reputation to color in member profile?
#1
How can I get this done? At the moment, it is white and placed as an a:link -- however, I would like the total number of reputation on member profile to be green for positive reputation, red if negative, and gray for neutral (all default colors).

ThanksĀ  Angel
Reply
#2
I did something similar for MyAlerts button. I did it with a javascript placed in the template after the button.

This is the javascript, you need to modify it to work for the reputation:

<script type="text/javascript">
 // if there is MyAlerts button, format it properly
var alerts = $("a.myalerts");
if(alerts.length)
{
var regex = /\(0\)$/;

if (alerts.text().match(regex))
alerts.css("color", "#fff");
else
alerts.css("color", "#CF3838");
}
</script>

It looks for an <a> tag that has the "myalerts" class. then it cheks if the content of the <a> tag ends inĀ "(0)" or not and sets the appropriate color.
Reply
#3
This is what I personally use. Requires PHP and Template Conditionals. For member_profile_reputation:

<if $memprofile['reputation'] < -10 then>
    Very untrustworthy
<elseif $memprofile['reputation'] < 0 then>
    Untrustworthy
<elseif $memprofile['reputation'] == 0 then>
    Neutral
<elseif $memprofile['reputation'] > 10 then>
    Very trustworthy
<elseif $memprofile['reputation'] > 0 then>
    Trustworthy
</if>

You can of course adjust the conditions to your needs, add or remove them, etc.. As long as you have an appropriate variable you can apply this to all templates (eg.: $reputation in postbit_reputation_formatted, $user['postreputation'] in postbit_reputation, and so on).
[Image: fSGNVQj.png]
Reply
#4
(08-02-2019, 08:58 AM)Shade Wrote: This is what I personally use. Requires PHP and Template Conditionals. For member_profile_reputation:

<if $memprofile['reputation'] < -10 then>
    Very untrustworthy
<elseif $memprofile['reputation'] < 0 then>
    Untrustworthy
<elseif $memprofile['reputation'] == 0 then>
    Neutral
<elseif $memprofile['reputation'] > 10 then>
    Very trustworthy
<elseif $memprofile['reputation'] > 0 then>
    Trustworthy
</if>

You can of course adjust the conditions to your needs, add or remove them, etc.. As long as you have an appropriate variable you can apply this to all templates (eg.: $reputation in postbit_reputation_formatted, $user['postreputation'] in postbit_reputation, and so on).

Worked great Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)