Advertisement:

Author Topic: Hiding Karma on a board-by-board basis?  (Read 2920 times)

Offline MrMike

  • Full Member
  • ***
  • Posts: 649
    • BotScout.com - Bust Those Bots!
Hiding Karma on a board-by-board basis?
« on: December 01, 2008, 12:24:55 AM »
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.

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Hiding Karma on a board-by-board basis?
« Reply #1 on: December 25, 2008, 04:31:24 AM »
You can use $context['current_board'] for that. Like this:

Display.template.php

Find:

Code: [Select]
// 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:

Code: [Select]
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

Offline MrMike

  • Full Member
  • ***
  • Posts: 649
    • BotScout.com - Bust Those Bots!
Re: Hiding Karma on a board-by-board basis?
« Reply #2 on: December 26, 2008, 12:48:44 PM »
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.

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Hiding Karma on a board-by-board basis?
« Reply #3 on: December 28, 2008, 03:48:11 AM »
My pleasure.
Former SMF Core Developer | My Mods | SimplePortal