Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Add a colour at Karma field at applaud result or at smite

Aloittaja Hotman, joulukuu 08, 2011, 04:26:37 AP

« edellinen - seuraava »

Hotman

Look for example

We have a member with Karma : 0

Now want I would like to do!

Karma : 1

and with the same way

Karma : -1

All Colours Sam

What karma mode are you using?

are you using some other mod for karma?
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Hotman

No , the standard official Karma from 2.0.1   

If it's necessary I can install one mod for this ... ( no problem )

All Colours Sam

assuming you're using total karma:

Your theme/Display.template.php  find:

         // Is karma display enabled?  Total or +/-?
         if ($modSettings['karmaMode'] == '1')
            echo '
                        <li class="karma">', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '</li>';


replace with:


// Is karma display enabled?  Total or +/-?
if ($modSettings['karmaMode'] == '1')
{
$total_karma = $message['member']['karma']['good'] - $message['member']['karma']['bad'];

if ($total_karma == 0)
$total_karma = '<span style="color: black;">'.$total_karma.'</span>';

elseif ($total_karma <= -1)
$total_karma = '<span style="color: red;">'.$total_karma.'</span>';

elseif ($total_karma >= 1)
$total_karma = '<span style="color: green;>"'.$total_karma.'</span>';

echo '
<li class="karma">', $modSettings['karmaLabel'], ' ', $total_karma, '</li>';
}


that should do it.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Hotman

#4
I am going to test it mate. Thanks for your try , I will edit my post for the results  8)


It isnt working , it's like blank, it doesnt show the number


hahahahaha you have a mistake lol at the + and i test it with your mistake look

<span style="color: green;>"'.$total_karma.'</span>';

Anyway thanks bro it's working

Resolved

Advertisement: