Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Aiheen aloitti: EvilElvis138 - maaliskuu 17, 2005, 02:13:36 IP

Otsikko: Avatars for admins and mods only
Kirjoitti: EvilElvis138 - maaliskuu 17, 2005, 02:13:36 IP
Is there any way I can make it so only admins/mods are able to select an avatar? I would like to use my company logo as my AV, but I don't want my users to have the option of picking any AV at all...not stock, external or uploaded.

Ideally I would like everyone but me to have a default avatar, the choosing of which to be completely invisible to the user during signup, just an invisible option. When they register (or in their control panel either), they don't see the option of picking an AV, they just have one automatically. But if that's too hard, none at all for anyone but admins/mods would be cool.  It's a support forum for my company, and I want to keep it professional looking and standardized.

I can turn off avatars altogether, but that makes mine disappear as well. TIA
Otsikko: Re: Avatars for admins and mods only
Kirjoitti: A.M.A - maaliskuu 18, 2005, 05:26:52 IP
If you have users already this may help.

in index.template.php look for:
if (!empty($context['user']['avatar']))
echo '<td valign="middle">', $context['user']['avatar']['image'], '</td>';

replace with:
if ( in_array(1, $GLOBALS['user_info']['groups']) || in_array(2, $GLOBALS['user_info']['groups']) )
echo '<td valign="middle">', $context['user']['avatar']['image'], '</td>';
else
echo '<td valign="middle"><img src="', $settings['images_url'], '/DEFAVY.gif" alt="" /></td>';

that will take care of index page where avatars are shown in the user info box.


in Display.template.php look for:
// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
echo '
<div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';

replace with:
// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
{
if ( $message['member']['group'] == 'Administrator' || $message['member']['group'] == 'Global Moderator' )
echo '
<div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';
else
echo '
<div style="overflow: auto; width: 100%;"><img src="', $settings['images_url'], '/DEFAVY.gif" alt="" /></div><br />';
}

and that will take care of the avatars in the posts.

You have to upload DEFAVY.gif to your images folder. Although users may choose avatars from their profiles, no one but Administrators and Global Moderator have use of it.
It can be hidden as well from the profile but will need extra modification.
Otsikko: Re: Avatars for admins and mods only
Kirjoitti: EvilElvis138 - maaliskuu 19, 2005, 03:01:55 AP
Thanks! I'll give this a shot. I thought maybe I was onto something with disabling av's altogether and just changing the 'star' images for the different member groups, but I seem to be having some problems there too, so hopefully this will do the trick.