How to load locally saved author photos based on author ID

One option is to use the pre_get_avatar filter to return custom avatar HTML, which will short-circuit get_avatar() preventing it from reaching out to Gravatar for the image. For example like this, add_filter(‘pre_get_avatar’, ‘wpse_410434_author_img_html’, 10, 3); function wpse_410434_author_img_html( $avatar, $id_or_email, $args ) { if ( $avatar || ! is_numeric( $id_or_email ) ) { return $avatar; } … Read more

Change the avatar ratio?

Possible sollutions: Use Css with something like overflow: hidden; and “cut out” what you need. Use the filter apply_filters(‘get_avatar’, $avatar, $id_or_email, $size, $default, $alt); and override the output of $avatar completely. The function get_avatar() is pluggable. That means if you hook a plugin function early enough that already defines get_avatar() then this function will be … Read more

avatar displays outside of targeted area

There is a native WordPress function to do exactly what it sounds like you’re trying to do. You need to replace userphoto_thumbnail($user_info, $before=””, $after=””, $attributes = array(width => ’40’, height => ’40’), $default_src=””) with get_avatar($user_info->ID,40) Check here for your future reference – http://codex.wordpress.org/Function_Reference/get_avatar

Subsite theme mystery man replacement with Buddypress on main site [closed]

The following code needs to placed in the functions.php file of any theme that has a replacement mystery man avatar. Adding it to bp-custom.php will not work in this instance. <?php // Use a differnt image than default mystery man function bp_custom_set_avatar_constants() { define( ‘BP_AVATAR_DEFAULT’, get_stylesheet_directory_uri() . ‘/images/mystery-man.jpg’ ); define( ‘BP_AVATAR_DEFAULT_THUMB’, get_stylesheet_directory_uri() . ‘/images/mystery-man-50.jpg’ ); … Read more