Uutiset:

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

Main Menu
Advertisement:

Total Idiot Question: How to make it so there is no Smite option with Karma.

Aloittaja fungusknuckle, tammikuu 25, 2006, 02:50:34 IP

« edellinen - seuraava »

fungusknuckle

Basically the question stated in the title. Is there any way, shape or form to change the Karma so that there is no smite, only applaud? I want it like this because we are on a friendly site, and we dont actually want people to be able to be smited, because well... you get it. So anyway, is there a way? Thanks in advance.

Oldiesmann

Sure. It's relatively easy to just remove that functionality altogether...

Sources/Karma.php

Find
// Applauding or smiting?
$dir = $_REQUEST['sa'] != 'applaud' ? -1 : 1;


Replace
// Applauding (no smiting allowed!)
$dir = 1;


Find
// Change by one.
updateMemberData($_REQUEST['uid'], array($dir == 1 ? 'karmaGood' : 'karmaBad' => '+'));


Replace
// Change by one.
updateMemberData($_REQUEST['uid'], array('karmaGood' => '+'));


Find
// It was recently changed the OTHER way... so... reverse it!
if ($dir == 1)
updateMemberData($_REQUEST['uid'], array('karmaGood' => '+', 'karmaBad' => '-'));
else
updateMemberData($_REQUEST['uid'], array('karmaBad' => '+', 'karmaGood' => '-'));


Replace
// Theoretically this will never happen since we can't smite anymore, but we'll change it anyway just in case...
updateMemberData($_REQUEST['uid'], array('karmaGood' => '+', 'karmaBad' => '-'));


Finally, a little template modification...

Themes/default/Display.template.php

Find
// Is this user allowed to modify this member's karma?
if ($message['member']['karma']['allow'])
echo '
<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';sesc=', $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'], ';sesc=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a><br />';


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


Themes/default/PersonalMessage.template.php

Find
// Is this user allowed to modify this member's karma?
if ($message['member']['karma']['allow'])
echo '
<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], ';', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pm=', $message['id'], ';sesc=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a> <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], ';', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pm=', $message['id'], ';sesc=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a><br />';


Replace
// Is this user allowed to modify this member's karma?
if ($message['member']['karma']['allow'])
echo '
<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], ';', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pm=', $message['id'], ';sesc=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a><br />';


Notes: If you're using 1.0.5, the code will look slightly different than what I've posted, and the last step will be in Themes/default/InstantMessage.template.php instead of PersonalMessage.template.php...
Michael Eshom
Christian Metal Fans

fungusknuckle


Advertisement: