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');
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.