Support

Account

Home Forums Bug Reports User image field doesn't return what it should – admin Reply To: User image field doesn't return what it should – admin

  • Thank you James, I’ve got the idea, If you don’t mind Im posting it publicly with a little modification to show thumbnails so it could be of use for anyone with this issue.

    function admin_avatar() { 
    
    		global $current_user;
    		$current_screen = get_current_screen();
    		
    
    		$avatar = get_field('custom_avatar', 'user_' . $current_user->ID ); 
    		
    		if( $avatar ) :
    
    			if( $current_screen->id == 'acf-field-group' || $current_screen->id == 'custom-fields_page_acf-settings-tools' ) :
    
    				$avatar = wp_get_attachment_image_src($avatar, 'thumbnail');		
    				echo '<img src="' . $avatar[0] . '">';
    
    			else :
    
    				echo '<img src="' . $avatar['sizes']['thumbnail'] . '">';
    
    			endif;
    		
    		endif;
    
    			
    	}
    
    	add_filter('adminmenu', 'admin_avatar');