MyBB Community Forums

Full Version: Show "default avatar" on Member List for users that do not have a avatar.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What we will achieve (Madona does not have an avatar):
[Image: heym.jpg]

Open PHP file memberlist.php (its a good idea to make a note somewhere that you have edited this file), and find:

eval("\$user['avatar'] = \"".$templates->get("memberlist_user_avatar")."\";");
		}
		else
		{
			$user['avatar'] = "";
		}	

Replace with:
eval("\$user['avatar'] = \"".$templates->get("memberlist_user_avatar")."\";");
		}
		else
		{
			$user['avatar'] = "<img src='images/default_avatar.gif' alt='User Avatar' title='' />";
		}		

^as one could see, all we did was add an image source to the blank field. "default_avatar.gif" is already included in your MyBB images folder.

Upload that memberlist.php to your root folder.

If you go to your memberlist webpage it should show the default avatar for users that have not set an avatar.

Finally:
Go to: ACP > Configurations > Settings > Member List
And change your "Maximum Display Avatar Dimensions" setting to "44x44". This setting was chosen because "default_avatar.gif" is 44x44 pixels in size.

Some inspiration from my forum:
[Image: mynez.th.jpg]
Thank you! Great tut!
Looks good an useful, thanks for sharing ^^