Advertisement:

Author Topic: Disabling karma for moderators/admins  (Read 23404 times)

Offline Burpee

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,298
  • Gender: Male
    • Mafan.nl
Disabling karma for moderators/admins
« on: October 31, 2004, 05:49:18 PM »
If you want to have the karma mod installed, but you don't want your moderators/admins to be judged by your users, this should be the way to do it. This does not require any modification to the source files.
These modifications work for certain on RC2, quite likely on newer versions as well.


Please remember to ALWAYS MAKE A BACKUP OF YOUR FILES!!!!!
I may have made some mistakes while typing this up - in case it doesn't work with you, post back here.


Open RC2\Themes\themename\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'], '">', $modSettings['karmaApplaudLabel'], '</a>
<a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], '">', $modSettings['karmaSmiteLabel'], '</a><br />';
Replace with:
Code: [Select]
// Is karma display enabled?  Total or +/-?
if ($message['member']['group_id'] != '1' && $message['member']['group_id'] != '2')
{
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'], '">', $modSettings['karmaApplaudLabel'], '</a>
<a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], '">', $modSettings['karmaSmiteLabel'], '</a><br />';
}

Open RC2\Themes\themename\Profile.template.php
Find:
Code: [Select]
// If karma enabled show the members karma.
if ($modSettings['karmaMode'] == '1')
echo '
<tr>
<td>
<b>', $modSettings['karmaLabel'], ' </b>
</td><td>
', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '
</td>
</tr>';
elseif ($modSettings['karmaMode'] == '2')
echo '
<tr>
<td>
<b>', $modSettings['karmaLabel'], ' </b>
</td><td>
+', $context['member']['karma']['good'], '/-', $context['member']['karma']['bad'], '
</td>
</tr>';
Replace with:
Code: [Select]
if ($context['member']['group_id'] != '1' && $context['member']['group_id'] != '2')
{
// If karma enabled show the members karma.
if ($modSettings['karmaMode'] == '1')
echo '
<tr>
<td>
<b>', $modSettings['karmaLabel'], ' </b>
</td><td>
', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '
</td>
</tr>';
elseif ($modSettings['karmaMode'] == '2')
echo '
<tr>
<td>
<b>', $modSettings['karmaLabel'], ' </b>
</td><td>
+', $context['member']['karma']['good'], '/-', $context['member']['karma']['bad'], '
</td>
</tr>';
       }

Now for one more thing, karma is still showing in the instant messages, so we need to get rid of that as well.

Open RC2\Themes\themename\InstantMessage.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'], ';f=', $context['folder'], ';start=', $context['start'], '">', $modSettings['karmaApplaudLabel'], '</a> <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], '">', $modSettings['karmaSmiteLabel'], '</a><br />';
Replace with:
Code: [Select]
if ($message['member']['group_id'] != '1' && $message['member']['group_id'] != '2')
{
// 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'], ';f=', $context['folder'], ';start=', $context['start'], '">', $modSettings['karmaApplaudLabel'], '</a> <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], '">', $modSettings['karmaSmiteLabel'], '</a><br />';
}


Now, just in case you're like me and still want to be able to see everybody's karma as an admin, you can also decide to add the following to Profile.template.php:
Find:
Code: [Select]
<div title="', $context['member']['hostname'], '" style="width: 100%; overflow: hidden; font-style: italic;">', $context['member']['hostname'], '</div>
</td>
</tr>';
Add after:
Code: [Select]
// If you still want the karma to be visible to admins, this should definitely be here.
if ($context['member']['group_id'] = '1' && $context['member']['group_id'] = '2')
{
if ($modSettings['karmaMode'] == '1')
echo '
<tr>
<td>
<b>', $modSettings['karmaLabel'], ' </b>
</td><td>
', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '
</td>
</tr>';
elseif ($modSettings['karmaMode'] == '2')
echo '
<tr>
<td>
<b>', $modSettings['karmaLabel'], ' </b>
</td><td>
+', $context['member']['karma']['good'], '/-', $context['member']['karma']['bad'], '
</td>
</tr>';

}


Hope you guys can use this... :)
« Last Edit: December 01, 2004, 01:53:18 PM by Burpee »

Offline Burpee

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,298
  • Gender: Male
    • Mafan.nl
Re: Not displaying karma for moderators/admins
« Reply #1 on: October 31, 2004, 06:38:30 PM »
Hmm... blah, for some reason that last bit produces the karma twice for admins:
Quote
Karma:  0
Karma:  0

I can't seem to figure it out. There seems to be no reason to do this, but for some reason it just does...
« Last Edit: October 31, 2004, 06:40:07 PM by Burpee »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Not displaying karma for moderators/admins
« Reply #2 on: October 31, 2004, 06:43:16 PM »
Where 'G' and 'A are the numbers for groups, right?

-[Unknown]

Offline Burpee

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,298
  • Gender: Male
    • Mafan.nl
Re: Not displaying karma for moderators/admins
« Reply #3 on: November 01, 2004, 03:39:07 AM »
Well, they're not numbers - but they work... and yes, they're the groups.
G = Global Moderator
A = Administrator

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Not displaying karma for moderators/admins
« Reply #4 on: November 01, 2004, 03:41:56 AM »
No, they don't work.... I promise you :P.  I think you want 1 (Administrators) and 2 (Global Moderators).

-[Unknown]

Offline Burpee

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,298
  • Gender: Male
    • Mafan.nl
Re: Not displaying karma for moderators/admins
« Reply #5 on: November 01, 2004, 03:58:09 AM »
Hmm... don't ask me how, but they work... 1 and 2 work too though...
When I echo'd $message['member']['group']['id'] it gave me G's and A's... so I thought that should fix it ;)

Anyway, the problem with the double display of the karma still doesn't seem to be solved...

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Not displaying karma for moderators/admins
« Reply #6 on: November 01, 2004, 04:02:47 AM »
That's because it's ['group_id'], not ['group']['id']...

-[Unknown]

Offline Burpee

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,298
  • Gender: Male
    • Mafan.nl
Re: Not displaying karma for moderators/admins
« Reply #7 on: November 01, 2004, 04:20:28 AM »
K, it's all fixed now :)

Offline BCCZeus

  • Semi-Newbie
  • *
  • Posts: 71
Re: Disabling karma for moderators/admins
« Reply #8 on: December 01, 2004, 12:58:38 PM »
Excellent job.  The code posted above worked for me.  No issues whatsoever . . . yet.

Offline Burpee

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,298
  • Gender: Male
    • Mafan.nl
Re: Disabling karma for moderators/admins
« Reply #9 on: December 01, 2004, 01:55:06 PM »
Good thing you posted here. I realised a while ago that the karma is still shown in the instant messages, so I added that modification to the first post.

Offline valkyrja

  • Newbie
  • *
  • Posts: 9
Re: Disabling karma for moderators/admins
« Reply #10 on: June 29, 2011, 11:40:07 AM »
The modification works for me in the Display.template.php but it doesn't work in Profile.template.php
This is part of the code there, what should I modify?

Code: [Select]
// If karma enabled show the members karma.
if ($modSettings['karmaMode'] == '1')
echo '
<dt>', $modSettings['karmaLabel'], ' </dt>
<dd>', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</dd>';

elseif ($modSettings['karmaMode'] == '2')
echo '
<dt>', $modSettings['karmaLabel'], ' </dt>
<dd>+', $context['member']['karma']['good'], '/-', $context['member']['karma']['bad'], '</dd>';

if (!isset($context['disabled_fields']['gender']) && !empty($context['member']['gender']['name']))
echo '
<dt>', $txt['gender'], ': </dt>
<dd>', $context['member']['gender']['name'], '</dd>';

echo '
<dt>', $txt['age'], ':</dt>
<dd>', $context['member']['age'] . ($context['member']['today_is_birthday'] ? ' &nbsp; <img src="' . $settings['images_url'] . '/cake.png" alt="" />' : ''), '</dd>';

if (!isset($context['disabled_fields']['location']) && !empty($context['member']['location']))
echo '
<dt>', $txt['location'], ':</dt>
<dd>', $context['member']['location'], '</dd>';

echo '
</dl>';

// Any custom fields for standard placement?

Thanks!