mm, I'm trying to write a modification that allows me to designate what membergroups can post certain message icons on certain/all boards.
At the moment, SMF has the function to restrict certain message icons to ONE board, and it has no function to allow certain membergroups using them in MULTIPLE boards.
What I'm trying to do is allow staff to choose a certain message icon when they make special threads, but I can't seem to find where I would alter the code, or to where I would alter the code to allow more then one board.
Can anyone help me with this? ^^;
You could modify the template to only allow staff to see those icons. As long as they exist in the directory they could still be used in any board.
Well, my original intention was to allow staff to choose an "extra" icon on each board with their message icons. Like whenever a staff member makes a post, the icon to designate that it is a "special" post would be in the drop-down, but if a normal user posts, they cannot choose to use that icon, they can only view it.
Ok.. You will need to edit it to match for your setup.
Open Post.php
Find:
if (!empty($context['icons']))
$context['icons'][count($context['icons']) - 1]['is_last'] = true;
Add before:
global $user_info;
$staff_groups = array(1, 5, 7);
if (in_array($user_info['groups'], $staff_groups))
{
$context['icons'][] = array(
'value' => 'MyImage',
'name' => 'Staff Icon',
'url' => $settings['theme_dir'] . '/images/post/MyImage.gif',
'is_last' => false,
}
So, something like this would work?
global $user_info;
$staff_groups = array(1, 2, 44);
if (in_array($user_info['groups'], $staff_groups))
{
$context['icons'][] = array(
'value' => 'exclamation',
'name' => 'Staff Icon',
'url' => $settings['theme_dir'] . '/images/post/exclamation.gif',
'is_last' => false,
}
That looks about right. You can always try it to see what it does. If there is any severe problems like a parse error you can always revert the changes or replace that file with a backup of the file.
Edit: Note quite actually.
Make it:
global $user_info;
$staff_groups = array(1, 2, 44);
if (in_array($user_info['groups'], $staff_groups))
{
$context['icons'][] = array(
'value' => 'exclamation',
'name' => 'Staff Icon',
'url' => $settings['theme_dir'] . '/images/post/exclamation.gif',
'is_last' => false,
);
}
Hmm...
I put in the code, but when I made a post as a regular member, I still had the ability to post the staff icon. x.x
Try changing the permissions of that icon so it's not available in all boards.
Thanks for posting that SleePy, It's something I've been looking for a way to do also.
Edit, another small correction:
Replace this line:
if (in_array($user_info['groups'], $staff_groups))
with this:
if (in_array($user_info['groups'][0], $staff_groups))
Work great. :)
Still doesn't work. x.x
What doesn't work? It works fine for me. Did you see my edit?
It doesn't work. It shows TWO icons instead of one and anyone can see them.
$staff_groups = array(1, 2, 44);
if (in_array($user_info['groups'][0], $staff_groups))
{
$context['icons'][0] = array(
'value' => 'exclamation',
'name' => 'LyokoGeniuses Icon',
'url' => $settings['theme_dir'] . '/images/post/exclamation.gif',
'is_last' => false,
);
}
EDIT: Lulz, I removed the transcript
Did you go into the Admin CP and change the permissions of that icon so that it's not available on all boards.