mbr_avatar
Usage
This shortcode retrieves a registered gravatar from gravatar.com and displays it.
If a user is not logged in or hasn’t registered their gravatar, the default avatar specified in your WordPress settings is displayed.
Parameters
Parameters | Description |
---|---|
Specifies the email address of the gravatar to be displayed. Default: The logged in user’s email address. Required: no. | |
size | Specifies the desired height and width for the displayed avatar. Default: As set in ActiveMember360, Settings, Miscellaneous, Default avatar size. Required: no. |
suppress_empty | Specifies whether to display a placebo avatar when the email address does not have an image registered at gravatar.com. Permitted Values: yes, y, true, t, or 1. Default: none. Required: no. |
Validity
This shortcode is evaluated for any type of visitor.
Conditional Branching
This shortcode does NOT support conditional branching with [ELSE_avatar].
Nesting
Shortcode nesting within is NOT supported.
Examples
- Example 1
- Example 2
- Example 3
- Example 4
Display the avatar registered at gravatar.com for the current logged in user's email address. If no avatar is registered the default image specified within WordPress, Settings, Discussion, Default avatar will be displayed. The avatar will be square with the size as specified within ActiveMember360, Settings, Miscellaneous, Default avatar size:
[mbr_avatar]
Display the avatar registered at gravatar.com for the current logged in user's email address. The avatar will be square with the size as specified within ActiveMember360, Settings, Miscellaneous, Default avatar size. If no avatar is registered nothing will be displayed:
[mbr_avatar suppress_empty='yes']
Display the avatar registered at gravatar.com for the current logged in user's email address. If no avatar is registered the default image specified within WordPress, Settings, Discussion, Default avatar will be displayed. The avatar will have a size of 96 pixels square:
[mbr_avatar size='96']
Display the avatar registered for email address john.smith@example.com at gravatar.com. If no avatar is registered the default image specified within WordPress, Settings, Discussion, Default avatar will be displayed. The avatar will have a size of 96 pixels square:
[mbr_avatar email='john.smith@example.com' size='96']
API
For direct use in PHP code use the structure as illustrated here:
echo mbr_avatar( array( 'email'=>'john.smith@example.com', 'size'=>96 ) );