News:

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

Main Menu

bbc tag admin/moderators only

Started by SleePy, November 08, 2005, 10:17:27 PM

Previous topic - Next topic

SleePy

i saw the little tip on how to do edit tags but it didnt help very much because i couldnt get it to work. so i messed around and finally got it to work. but i want to make it so if anyone but the admin or moderator uses the tag it does nothing.
im thinking if statements work in arrays (not 100% sure), so if that is possible can i check if the person is the admin or moderator of that board and allow them to use the edit tags

heres the code im using

array(
'tag' => 'moderator',
'before' => '<div style="font-size: x-small; font-weight: 600;">The Moderator comments:</div><div style="border: 1px solid black; font-size: x-small; font-weight: bold; padding: 2px;">',
'after' => '</div>',
),
array(
'tag' => 'moderator',
'type' => 'unparsed_equals',
'before' => '<div style="font-size: x-small; font-weight: 600;">The Moderator, $1, comments:</div><div style="border: 1px solid black; font-size: x-small; font-weight: bold; padding: 2px;">',
'after' => '</div>',
'disabled_after' => ' ($1)',
),


Thank you very much for Help
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Oldiesmann

Sources/Subs-Post.php

Find
if (!empty($modSettings['disabledBBC']))
{
$temp = explode(',', strtolower($modSettings['disabledBBC']));

foreach ($temp as $tag)
$disabled[trim($tag)] = true;
}


Replace
if (!empty($modSettings['disabledBBC']))
{
$temp = explode(',', strtolower($modSettings['disabledBBC']));

foreach ($temp as $tag)
$disabled[trim($tag)] = true;

if(!$user_info['is_admin'] && !in_array(array('2', '3'), $user_info['groups']))
$disabled['moderator'] = true;
}


That will check for admin status, global mods and regular mods
Michael Eshom
Christian Metal Fans

Elmacik

Putting an exclamation to the start is enough Oldiesmann ?
I mean, wont your codes disallow regular moderators to use bbc tags? (because it says disabled)
Note: Dont think I ask because I object, I just want to learn much :)
Home of Elmacik

SleePy

so even though the tags are disabled the admins and moderators can use them then?
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Elmacik

Not not. Because it checks if BBC is enabled. But the way Oldiesmann told you will make BBC available only for admins, gmods and mods. Others wont be able to use whether BBC is enabled or disabled
Home of Elmacik

SleePy

so how can i make it so only admins can use certain tags?

couldnt i put an if in the arrray?



                  array(
                                'tag' => 'moderator',
                            if(id == admin) /* how ever i check the user is admin or mod */
                            {
                              'before' => '<div style="font-size: x-small; font-weight: 600;">The Moderator comments:</div><div style="border: 1px solid black; font-size: x-small; font-weight: bold; padding: 2px;">',
                              'after' => '</div>',
                            } else {
                              'before' => '',
                              'after' => '',
                            }
                      ),
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Elmacik

use this:
if($context['user']['is_admin']);
hopefully it will work
Home of Elmacik

Advertisement: