Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Anonyomus on August 22, 2015, 10:32:56 AM

Title: Question about topic(s)
Post by: Anonyomus on August 22, 2015, 10:32:56 AM
Hello!
First of all, sorry if posted it to wrong topic (newb >_<), and sorry for eng.

My question is, how can i disable to users, to change topic icon (angry face, etc...)
i mean, check the img http://i.imgur.com/b8jTf5d.png?1, the users can change their topic's icon, and i want to remove this function not the icons, just users dont change icon, the only person who can change is admin (myb from PMA if needed)

Thanks for help!
Title: Re: Question about topic(s)
Post by: margarett on August 22, 2015, 02:48:39 PM
For you to disable the possibility to change the icon directly in the topic display (eg, when viewing posts inside a topic):
Display.template.php
Find:
<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />

Replace with:
<img src="', $message['icon_url'] . '" alt=""', $context['user']['is_admin'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />


For you to disable the possibility to change the icon when creating or editing a post:
Post.template.php, find:
</dd>
<dt class="clear_left">
', $txt['message_icon'], ':
</dt>
<dd>
<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="" />
</dd>

Replace with:
</dd>';
if ($context['user']['is_admin'])
{
echo '
<dt class="clear_left">
', $txt['message_icon'], ':
</dt>
<dd>
<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="" />
</dd>';
}
echo '


I think I didn't forget anything :P