News:

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

Main Menu

Disabling karma for moderators/admins

Started by Burpee, October 31, 2004, 05:49:18 PM

Previous topic - Next topic

Burpee

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:
// 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:
// 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:
// 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:
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:
// 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:
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:
<div title="', $context['member']['hostname'], '" style="width: 100%; overflow: hidden; font-style: italic;">', $context['member']['hostname'], '</div>
</td>
</tr>';

Add after:
// 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... :)

Burpee

#1
Hmm... blah, for some reason that last bit produces the karma twice for admins:
QuoteKarma:  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...

[Unknown]

Where 'G' and 'A are the numbers for groups, right?

-[Unknown]

Burpee

Well, they're not numbers - but they work... and yes, they're the groups.
G = Global Moderator
A = Administrator

[Unknown]

No, they don't work.... I promise you :P.  I think you want 1 (Administrators) and 2 (Global Moderators).

-[Unknown]

Burpee

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...

[Unknown]

That's because it's ['group_id'], not ['group']['id']...

-[Unknown]

Burpee


BCCZeus

Excellent job.  The code posted above worked for me.  No issues whatsoever . . . yet.

Burpee

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.

valkyrja

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?

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

Advertisement: