Tiny Brown Mushroom

Test logged in user avatar display

No Entries Found

[display-user-avatar]

This is the logged-in user’s avatar displayed using a get_avatar function shortcode. However, the Blocksy account element does not display this same avatar if it was uploaded by Formidable Forms. Below is the “Show user avatar shortcode” in the Snippets plugin.

//To display, add the shortcode [display-user-avatar] to a page or post
//
function shortcode_user_avatar() {
if(is_user_logged_in()) {
global $current_user;
get_currentuserinfo();
return get_avatar( $current_user -> ID, 120 );
}
else {
// If not logged in then show default avatar. Change the URL to show your own default avatar
return get_avatar( 'http://1.gravatar.com/avatar/ad524503a11cd5ca435acc9bb6523536?s=120');
}
}

add_shortcode('display-user-avatar','shortcode_user_avatar');

The WordPress Author block below does display the avatar uploaded by Formidable Forms. Note: The author of this particular post is programmatically changed to whoever the current logged-in user is if any for testing purposes.

However, the Blocksy author box below also does not display this same avatar if it was uploaded by Formidable Forms.

mmsweb1899
mmsweb1899
Articles: 35

Leave a Reply

Your email address will not be published. Required fields are marked *