• Resolved stelloo

    (@stelloo)


    Hello. I used one menu item to display user avatar, but it doesn’t show the avatar the user has chosen, but the default wordpress avatar (https://prntscr.com/g5lrxc). Some plugins I have installed that may affect the result are:
    -Buddypress
    -ARMember

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    @stelloo – Sorry for the delay. Can you tell me what plugin allows your users to upload there own avatar? We purely call get_avatar() which is a built in WP function to get the image. If the correct image isn’t showing it likely means that they didn’t add any code to override the WP get_avatar call, which means we can’t really do anything on our end to help.

    I’d be surprised if buddypress had avatar functionality without the proper filters in place though.

    Hope that helps.

    Thread Starter stelloo

    (@stelloo)

    Hello @danieliser

    The plugin that allows users to upload their own avatar is ARMember.
    I have tried the following code in a place on the website, and the custom avatar was visible:

                         <?php
        global $current_user;
        if ( is_user_logged_in() ):
            get_currentuserinfo();     
            echo get_avatar( $current_user->ID, 64 );
        endif;  
    ?>

    However, when I use the {avatar} option as a menu item, i get the default mysterious man. Could you point me out where in the code does the plugin call the avatar function so I can check if everything is ok?

    Thanks,

    Go to the file: wp-content/plugins/user-menus/includes/classes/items.php

    Find this line:

    case 'avatar':
    $replace = get_avatar( $current_user, self::$current_item->avatar_size );
    						break;
    

    Change it as follows:

    case 'avatar':
    $replace = get_avatar( get_the_author_meta('ID'), '80' );
    						break;
    

    The ’80’ represents the avatar size, this size can be coded in to work with the plugin options but not had time to complete that bit yet. However the above edit should work for you.

    • This reply was modified 7 years, 6 months ago by mattyshigh.
    • This reply was modified 7 years, 6 months ago by mattyshigh.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Avatar not loading’ is closed to new replies.