MyBB Community Forums

Full Version: Disable Avatars for Guests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I know how to shut off avatars for registered members via their CP, however, I don't think there's a way to not show avatars to guests.

I'd appreciate if someone could make this mod. The reason for it is to help conserve bandwidth as well as to decrease loading time as some members have those 1MB gif avatars, and due to an issue I was having with the content of some avatars.
open the file ".\inc\functions_post.php" and find that section:
(Line 241 in my untouched file)
if($post['avatar'] != "" && $mybb->user['showavatars'] != "no")
		{
			$post['avatar'] = htmlspecialchars_uni($post['avatar']);
			$avatar_dimensions = explode("|", $post['avatardimensions']);
			if($avatar_dimensions[0] && $avatar_dimensions[1])
			{
				$avatar_width_height = "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\"";
			}
			eval("\$post['useravatar'] = \"".$templates->get("postbit_avatar")."\";");
		}
		else
		{
			$post['useravatar'] = "";
		}
that is the code that insert the avatar when building the postbit, whether it's a PM a post or a preview.

change the first line to this:
if($post['avatar'] != "" && $mybb->user['showavatars'] != "no" && $mybb->user['uid'] != 0)
this's just add the condition that the user isn't a guest.

EDIT: I've tested that just now on my testing board and it worked, goodluck Smile
PwnEm, you might want to seriously consider putting a max size limit on avatars. 1MB seems more than a bit excessive.
Meh, yeah it does. But I don't either. Plus sometimes guests steal your AWESOME avatars and they become un-exclusive.
you can past your nick into the avatar, such it would be less attractive to steal it.
@ dvb, thanks.

Well I'm allowing them to hotlink their avatars, so those large avatars are usually hosted on Photobucket etc. however, they are a pain to load if you're not on high speed, or if you're browsing from a mobile device.
why you're need such large avatar size?
IMO it's far too much
Well some users like animated avatars, and they tend to be rather big.

But it won't be a problem for guests and/or visitors surfing the site from a mobile device any more due to the mod. Smile
Oh, so you'll just make your actual members suffer through the long loading times? Toungue
Well they can disable avatars in the User CP if it's a problem to them.

Since I have a good connection it literally takes 1 or 2 seconds to a load a page despite the fact that there might be a couple of animated avatars in the post. And so far I haven't gotten any complaints so they seem to have a good connection as well.

It would be nice if a member could block certain avatars such as those large ones, but for now this will do.
Pages: 1 2