How to change avatar of the comment author using comment ID?

You can use pre_get_avatar filter to manipulate comment avatar html and stop WP from getting a default avatar for the comment. Passing a non-null value will effectively short-circuit get_avatar(), passing the value through the ‘get_avatar’ filter and returning early. E.g. add_filter( ‘pre_get_avatar’, ‘my_filter_pre_get_avatar’, 10, 3 ); function my_filter_pre_get_avatar( $avatar_html, $id_or_email, $args ) { if ( … Read more

Use Gravatar as fallback image if no local image is not found

You can use the get_avatar_url filter (see the arguments passed here in the source code) to change the avatar url and then simply use get_avatar() with the user email in the theme as you’re used to. add_filter(‘get_avatar_url’, ‘wpse_avatar_or_gravatar’, 10, 3); function wpse_avatar_or_gravatar($url, $id_or_email, $args) { // was id passed via $id_or_email if ($id_or_email == intval($id_or_email)) … Read more

Cannot get local avatars to show [closed]

Debug ideas: You could try to see if this has any effect: add_filter( ‘bp_core_fetch_avatar_no_grav’, ‘__return_true’ ); But you should check out the parameters that go through the bp_core_fetch_avatar filter to see if they are correct (untested): add_filter( ‘bp_core_fetch_avatar’, ‘my_bp_core_fetch_avatar’, 99, 9 ); function my_bp_core_fetch_avatar( $html, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir ) { … Read more

Replace comment avatars and links at the same time

Maybe I was burned out from work before, but this morning I took another go at the same code and managed to get it running properly. if ( ! function_exists( ‘comment_imgs’ ) ) { add_filter( ‘get_comment_author_url’, ‘comment_imgs’ ); function comment_imgs( $avatar, $id_or_email, $size, $default, $alt ) { global $comment; // We do not get the … Read more

Get users only if Gravatar is specified

Gravatar by design doesn’t require the downstream system to be aware if there is a match. The image (if any) is determined and served on request, only hash needs to be provided. It’s impossible to “guess” from email or its hash if it has an avatar. That can only be resolved by request to the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)