• Welcome to Simple Machines Community Forum. Please login or sign up.
December 05, 2021, 01:08:40 AM

News:

Want to get involved in developing SMF, then why not lend a hand on our github!


Hiding Karma on a board-by-board basis?

Started by MrMike, December 01, 2008, 12:24:55 AM

Previous topic - Next topic

MrMike

Is it possible to hide Karma from a particular group of message boards?

I have 2 boards out of ~70 that I'd like to hide it on- the people there are complaining about it endlessly (you'd have to know them, lol). They're obsessed with their karma and how it varies, etc etc etc. So I'd just like to hide it for this set of boards.

Is this possible? Give me an idea of how or where to do it and I'll hard-code it into my system.

[SiNaN]

You can use $context['current_board'] for that. Like this:

Display.template.php

Find:

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

// 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:

if (!in_array($context['current_board'], array(1, 2, 3, 4)))
{
// Is karma display enabled?  Total or +/-?
if ($modSettings['karmaMode'] == '1')
echo '
<br />
', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '<br />';
elseif ($modSettings['karmaMode'] == '2')
echo '
<br />
', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '<br />';

// 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 />';
}


...where 1, 2, 3, 4 are the IDs of the boards.
Former SMF Core Developer | My Mods | SimplePortal

MrMike

Thanks, Blue Dream. I "solved" this problem with the Karma Piggy modification (now the users *want* the Karma enabled, lol) but I'll save this code for another use I have in mind. Thank you again.

[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

Advertisement: