News:

Wondering if this will always be free?  See why free is better.

Main Menu

Change Karma links (applaud/smite) to images

Started by agent47, February 08, 2011, 03:16:30 PM

Previous topic - Next topic

agent47

I'm using SMFs in-build Karma system and I wish to know know what I need to edit to change the applaud and smite links to image buttons as shown below. My site is running on SMF RC3.


PortaMx is probably the best SMF portal!

Matthew K.

Take a peak in Display.template.php at how the Karma links are outputted. You should be able to find them very easily by searching for "Karma"

agent47

Found it.

// 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>';
elseif ($modSettings['karmaMode'] == '2')
echo '
<li class="karma">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '</li>';

// Is this user allowed to modify this member's karma?
if ($message['member']['karma']['allow'])
echo '
<li class="karma_allow">
<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a>
<a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a>
</li>';


Now?

PortaMx is probably the best SMF portal!

Matthew K.

Code (Find) Select
                           <a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a>
                           <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a>

Code (Replace) Select
                           <a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><img src="Applaud Label Image Link" alt="', $modSettings['karmaApplaudLabel'], '" border="" /></a>
                           <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><img src="Negative Label Image Link" alt="', $modSettings['karmaSmiteLabel'], '" border="" /></a>

agent47


PortaMx is probably the best SMF portal!

Matthew K.


iain sherriff

I tried to do the above using
/forum/Themes/default/images/up.gif
and
/forum/Themes/default/images/down.gif

with the images in that folder but I get the message below......which I dont understand enough to know what I did wrong  ::)

Can you help me please?

thanks

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in .../Themes/default/Display.template.php on line 304

295: echo '
296: <li class="rc5">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'];
297:
298: // Is this user allowed to modify this member's karma?
299: if ($message['member']['karma']['allow'])
300: echo '
301:                            <a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><img src="/forum/Themes/default/images/up.gif" alt="', $modSettings['karmaApplaudLabel'], '" border="" /></a>
302:                            <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><img src="/forum/Themes/default/images/down.gif" alt="', $modSettings['karmaSmiteLabel'], '" border="" /></a>
303:

304:        if (($modSettings['karmaMode'] == '1') || ($modSettings['karmaMode'] == '2'))

305: echo '
306: </li>';
307:
308:
SMF 2.0.12

Matthew K.


iain sherriff

wow that wa sprompt :)

long shifts all weekend so i will try it again on mnday. thakns
SMF 2.0.12

bestfriendavinash

Alternatively you can go to

Administration Center » Features and Options » Karma

and then use following html code in Karma applaud label/Karma smite label

<img src="direct link to your image">

I'm doing like this only... please tell us if the same has worked for you as well!

OzzyMozzy

Quote from: bestfriendavinash on April 21, 2012, 11:35:09 PM
Alternatively you can go to

Administration Center » Features and Options » Karma

and then use following html code in Karma applaud label/Karma smite label

<img src="direct link to your image">

I'm doing like this only... please tell us if the same has worked for you as well!

Just used that, thanks it works perfectly

bestfriendavinash

Quote from: OzzyMozzy on April 22, 2012, 04:45:20 AM
Quote from: bestfriendavinash on April 21, 2012, 11:35:09 PM
Alternatively you can go to

Administration Center » Features and Options » Karma

and then use following html code in Karma applaud label/Karma smite label

<img src="direct link to your image">

I'm doing like this only... please tell us if the same has worked for you as well!

Just used that, thanks it works perfectly

Wow...  :)

iain sherriff

SMF 2.0.12

Ninja ZX-10RR

Quote from: bestfriendavinash on April 21, 2012, 11:35:09 PM
Alternatively you can go to

Administration Center » Features and Options » Karma

and then use following html code in Karma applaud label/Karma smite label

<img src="direct link to your image">

I'm doing like this only... please tell us if the same has worked for you as well!
Sorry for necroposting but i just wanted to tell you a huge thanks for that simple thing. Works perfectly with SMF 2.07, hopefully users looking for this feature will see this post and use this trick instead of installing the whole mod.
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Advertisement: