Automatic Message Icon

Started by Old Lynx, June 11, 2008, 04:04:11 AM

Previous topic - Next topic

Old Lynx

Hi Guys

Can someone tell me How to disable normal memebers from using Message Icons. I want the Admin to be the only one who can use them.



Any help given would be greatly appreciated.

Thanks Guys

Old Lynx

is this hard to do ? someone please help :(


Cccddd

If you want to get rid of members' ability to use message icons, just edit the Post.template.php so if they aren't an admin then it doesnt show the option.

adding buttons... that's a lot more difficult.

Old Lynx

#4
Hi Cheschire :)

OK can you tell me what code exactly I need to look for in the post.template.php and what do I change it to ? I'm a n00b so clear instructions would be greatly appreciated. Let's do this easy bit first and then get onto the buttons !

Thanks man :)

Jade Elizabeth

In my experience when I removed that, and the users edited the post, it would look for an icon called ".gif" instead of "xx.gif" and it caused a lot of trouble. There is a mod you can use however:

http://custom.simplemachines.org/mods/index.php?mod=1168
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Jade Elizabeth

If you're in 1.1.x you can use this:

'altlinks' => array('code' => 'altlinks', 'before' => '[center][b][size=14]ALTERNATE LINKS[/size][/b][/center]', 'description' => 'altlinks'),


Put that after the button you like in the post.template.php, for the end of the list search for this:

'list' => array('code' => 'list', 'before' => '[list]\n[li]', 'after' => '[/li]\n[li][/li]\n[/list]', 'description' => $txt[261]),


Put an image in the theme folders > bbc > altlinks.gif

Karl has been teaching me to make BBC tags :D.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Old Lynx

Thanks Alundra You are a GREAT HELP :)

Thanks :)

Bulakbol

To hide message icon from the rest except admin, in the default/Post.template.php, look for
// Now show the subject box for this post.
echo '
<tr>
<td align="right" style="font-weight: bold;', isset($context['post_error']['no_subject']) ? 'color: red;' : '', '" id="caption_subject">
', $txt[70], ':
</td>
<td>
<input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" />
</td>
</tr>
<tr>
<td align="right">
<b>', $txt[71], ':</b>
</td>
<td>
<select name="icon" id="icon" onchange="showimage()">';

// Loop through each message icon allowed, adding it to the drop down list.
foreach ($context['icons'] as $icon)
echo '
<option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>';

echo '
</select>
<img src="', $context['icon_url'], '" name="icons" hspace="15" alt="" />
</td>
</tr>';



and replace with
// Now show the subject box for this post.
echo '
<tr>
<td align="right" style="font-weight: bold;', isset($context['post_error']['no_subject']) ? 'color: red;' : '', '" id="caption_subject">
', $txt[70], ':
</td>
<td>
<input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" />
</td>
</tr>';
if ($context['user']['is_admin'])
{
echo '
<tr>
<td align="right">
<b>', $txt[71], ':</b>
</td>
<td>
<select name="icon" id="icon" onchange="showimage()">';

// Loop through each message icon allowed, adding it to the drop down list.
foreach ($context['icons'] as $icon)
echo '
<option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>';

echo '
</select>
<img src="', $context['icon_url'], '" name="icons" hspace="15" alt="" />
</td>
</tr>';
}
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Jade Elizabeth

No problem at  all :)

JB, that caused troubles for me last time when non admin users inline (mostly) edited...
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Bulakbol

oh really? I didn't test it. Thanks Alundra. I'll test it when I have a chance.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Jade Elizabeth

No problem, the topic is missing from my site, otherwise I would link you, but basically my users noticed it and I didnt (firefox doesnt display boxes for missing images) so they reported it.

They tested it out, and turns out inline and normal edit messed it up, made the post look for ".gif" instead of "xx.gif".
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Bulakbol

#12
I tested the codes I posted above and the error was undefined index "icon". If you would like to try the above codes, you have to edit Sources/Post.php too. Look for
'icon' => preg_replace('~[\./\\\\*\':"<>]~', '', $_POST['icon']),

and replace with
'icon' => !empty($_POST['icon']) ? preg_replace('~[\./\\\\*\':"<>]~', '', $_POST['icon']) : '',


edit: The snippet of code I posted will only hide the icons from regular members. Admin can change it, so there will be no missing icon error.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Old Lynx

OK let me go and backup them two files and edit them.

I'll let you guys know if it worked !

thanks :)

Old Lynx

OK I just did them code changes and it didn't work !!

All regular members can still see it ! :(

Jade Elizabeth

Are you sure you copied the entire code? JB's code looks right to me.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Old Lynx


Jade Elizabeth

So you edited the post template inside all the themes, and then the post source file too?
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Old Lynx

lol no not inside all theme !! only inside the default theme ! cause that is what he said !!

So I should go and do it for every single theme ?

Old Lynx

OMG it WORKED !!!

I did it for the default theme and the theme I was currently using and it worked !!!!!

Thanks VERY MUCH Alundra and JohnyB  You guys are GREAT :)

Thanks :)

Advertisement: