MyBB Community Forums

Full Version: Where is $post['avatar']?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Where is this variable created: $post['avatar'] I need to add in a blank image if the user didn't specify one becuase I'm listing avatars in the member's list, and it doesn't work if there's no avatar (and there aren't any conditionals in templates). Thanks.
Template manager> Post Bit Templates (expand)> postbit_avatar

or you want to know where is the php code created the $post['avatar']?

~zenko
The PHP code, because if it's empty I need to add in something like a clear.gif, and you can't do if-then statements in templates.
Thought so was just being lazy ^^

Locate your the "inc" folder and look for you "functions_post.php" file.
myBB/inc/functions_post.php

Around line: 241
Find:
if($post['avatar'] != "" && $mybb->user['showavatars'] != "no")

That'st the starting point for the avatar code, hope that helped. Smile

~z
Spike Wrote:Where is this variable created: $post['avatar'] I need to add in a blank image if the user didn't specify one becuase I'm listing avatars in the member's list, and it doesn't work if there's no avatar (and there aren't any conditionals in templates). Thanks.

Actually there are sevral ways to do this, such as an automatic avatar on registration etc.. but i see this way more stable and obligatory for the users.

open ./inc/functions_post.php

find

$post['useravatar'] = "";

and replace it with

$post['useravatar'] = "<img src="IMAGEHERE" border="0" />";
Maybe I will make a default avatar plugin.
Sorry... this isn't working. What I meant was, where is the variable "$users['avatar'] set... it's the same thing, essentially, but in the Memberlist. ($post has no effect in the memberlist, that's why I was having troubles)
oh in memberlist .... then in memberlist.php

above
eval("\$member .= \"".$templates->get("memberlist_row")."\";");
put
	if($users['avatar'] == '')
	{
		$users['avatar'] = '<img src="default_avatar.gif" border="0" />';
	}
Oh.... duh, haha. Thanks *smacks forehead* Smile