XF 2.0 Template condition if user has no avatar?

Most accurate would probably be to check {$user.getAvatarType()}. That will return "gravatar", "custom" or "default". Default means they have no avatar.
Seem this is the code to check user avatar and not is a template var because I tried to put into templates but it didn't show anything.
 
That can be used in templates. Are you trying to use it in a template that has the user variable? Or are you trying to check it for the currently logged in user?

If the latter you would use {$xf.visitor.getAvatarType()
 
That can be used in templates. Are you trying to use it in a template that has the user variable? Or are you trying to check it for the currently logged in user?

If the latter you would use {$xf.visitor.getAvatarType()
You are right and it needs a conditional statement around it to make this code work.

Thanks Chris!
 
Back
Top Bottom