Avatar picture is broken
Avatar picture is broken
Avatar picture is broken
how to separate gravatar picture and new user picture
By default WordPress does not display an avatar for a pingback or a trackback – do they even contain an e-mail address? You can add these to the get_avatar_comment_types filter if you want to change this.
I worked out I needed to add quotes around the parameter. echo get_avatar(get_the_author_meta(‘user_email’), ’70’, “‘” . get_bloginfo(‘template_directory’).”/images/default.png'”);
The get_avatar function is pluggable, meaning that you can define a function of your own having that name and completely overwrite the default function. If you look at the source for the “Simple Local Avatars” plugin, that is exactly what it has done. get_avatar in your code should be using the function defined by “Simple … Read more
This function bp_get_user_has_avatar() calls bp_core_fetch_avatar with this argument ‘no_grav’ => true so you could write your own function to see if a user is not using the default avatar: function lurie_avatar_check( $user_id ) { $retval = false; if ( bp_core_fetch_avatar( array( ‘item_id’ => $user_id, ‘no_grav’ => false, ‘html’ => false ) ) != bp_core_avatar_default( ‘local’ … Read more
You’re looking for the get_avatar function, documented here get_avatar( $id_or_email, $size, $default, $alt ) You’ll need either a user ID, or an email to use it, something like this should do the trick: echo get_avatar( get_comment_author_email(), ‘thumbnail’ ); If avatars are turned off in settings, this function will not return anything
You cannot make gravatars work offline (they completely rely on remote service), but you can get rid of erorrs and slowdown when offline by overriding them. You can use get_avatar filter for it. There is an Airplane Mode plugin for offline WP dev that does this (among other things). You can use that or just … Read more
The get_avatar function is a pluggable function with it’s first parameter being either the user’s ID or email. You’re using get_avatar with get_the_author_meta(‘ID’) which should give you the ID of the current user within the Loop. From the Codex If used within The Loop, the user ID need not be specified, it defaults to current … Read more
The get_avatar() function has many arguments, the last one is the interesting one, because you can pass additional classes, also described in the codex. So instead of get_avatar( $comment, $args[‘avatar_size’] ); you could use get_avatar( $comment, $args[‘avatar_size’], ”, ”, array(‘class’ => ‘myclass’) );