• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How do I change the default avatars?

Akrion

Well-known member
#1
Hi guys,

I am building a custom style and I am @ the point where I would like to modify the default avatars (Male, Female and the ? one) ... so my question is - is that doable through debug mode menus or I have to replace the default style avatar images in the "avatars" folder?

Thanks in advance!
Akrion
 

Jake Bunce

XenForo moderator
Staff member
#2
I would just replace the existing images:

styles/default/xenforo/avatars

Or create a new style if you want to use a different image path.

_____

There is no specific setting that you can edit for the location of the default avatars. There is only the root path for all images in a style:

Admin CP -> Appearance -> Style Properties -> General -> Path to images

Screen shot 2011-01-31 at 8.54.46 PM.png

See this file if you are curious about the code:

library/XenForo/Template/Helper/Core.php

Code:
	/**
	 * Returns the default gender-specific avatar URL
	 *
	 * @param string $gender - male / female / other
	 * @param string $size (s,m,l)
	 *
	 * @return string
	 */
	protected static function _getDefaultAvatarUrl(array $user, $size)
	{
		switch ($user['gender'])
		{
			case 'male':
			case 'female':
				$gender = $user['gender'] . '_';
				break;

			default:
				$gender = '';
				break;
		}

		return self::styleProperty('imagePath') . "/xenforo/avatars/avatar_$gender$size.png";
	}