News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Not show avatars in posts to certain user groups

Started by Karri, January 07, 2005, 04:51:18 PM

Previous topic - Next topic

Karri

I would like to not have the avatars display to my guests and to the lower level post groups.  Basically this is what I am trying to do... I want the admins and the VIPs to see the avatars at all times regardless which secondary post group they are in.  But I do not want the guests and normal members (those with out a primary user group such as admin or vip) with only a few posts to see the avatars.  I am sure it would be as simple as adding an if statement to this bit of code in the display.template.php
// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !$context['user']['is_guest'] && !empty($message['member']['avatar']['image']))

echo '
<div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';


I have already managed to stop the guests from seeing the avatars based on a post I found elsewhere on this site but I am stuck on stopping the lowest user group from seeing them.  Any suggestions?

[Unknown]

What's the ID_GROUP (it's a number) of the group you want not to see avatars?

-[Unknown]

Karri

The ID_GROUP is 4, the groupName is "On The Tarmac".

Thanks for your help!!! :)

[Unknown]

in_array(4, $GLOBALS['user_info']['groups'])

That will tell you if they are in that group.  All you have to do is say:

if (in_array(4, $GLOBALS['user_info']['groups']))
   echo 'You are a n00b, sucka.';
else
   echo 'Hmm... not a n00b, are you?  That either means you\'re a guest, or you have posted a lot!';

-[Unknown]

Karri

Ok I changed the display avatar section to this which seems to work (if the code is bad please let me know, it won't hurt my feelings :) ) // Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !$context['user']['is_guest'] && !empty($message['member']['avatar']['image']) && !(in_array(4, $GLOBALS['user_info']['groups'])))

echo '
<div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';


How would I exclude those in group 4 who's primary user group is VIP? (group 9)   Example, a VIP with only 20 posts is primary group 9 but secondary group 4.

Thanks!!!

[Unknown]

// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !$context['user']['is_guest'] && !empty($message['member']['avatar']['image']) && (in_array(9, $GLOBALS['user_info']['groups']) || !in_array(4, $GLOBALS['user_info']['groups'])))
echo '
<div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';


You're moving into an area where it might even be worth adding your own custom permission (which is more involved, but still not that difficult...)

-[Unknown]

Karri

that actually sounds cool, so I would be able to go into the edit permissions and click on and off the viewing of other's avatars?  I see your instructions at http://www.simplemachines.org/community/index.php?topic=19136.0  any pointers on top of that?  Or detailed step by step instructions even? :) 

Thanks!!!

[Unknown]

Well, I'll probably write up a more formal tutorial later, but that's the basics...

-[Unknown]

Advertisement: