1. 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?

Discussion in 'XenForo Questions and Support' started by Akrion, Feb 1, 2011.

  1. Akrion

    Akrion Well-Known Member

    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
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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";
    	}
    
     
  3. Akrion

    Akrion Well-Known Member

    Thanks a lot Jake. Exactly what I needed!
     

Share This Page