• Resolved madhu756

    (@madhu756)


    Hi support,
    I want to add a profile page to my menu. It should display the image after login.
    I want a profile menu like as QUORA website https://www.quora.com/
    Could you please help me how to do it?
    I am using Astra Pro Theme & Ultimate Member plugin for profile, login & register.

    Thank you!!!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi,

    Could you please provide a screenshot of the element in quora that you want to apply to your site?

    Regards,

    Thread Starter madhu756

    (@madhu756)

    Hi support,
    Thank you for your reply.
    I want that if any user logged in then it should display their profile image on a menu like Quora or any website. Please check the below link if u want to see how it is.
    https://pasteboard.co/JGv2RiS.jpg

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @madhu756

    Sorry for the late response.

    You can try this code snippet:

    
    add_filter( 'wp_nav_menu_items', 'um_011420_avatar_menu', 10, 2 );
    function um_011420_avatar_menu( $items, $args ) {
        
        if( is_user_logged_in() ){
            $user_id = get_current_user_id();
            um_fetch_user( $user_id );
            $avatar = "<img src='".um_get_user_avatar_url()."' style='width:40px;border-radius:60px;' />";
            $items = str_replace( '{um_avatar}', $avatar, $items );
        }
        return $items;
    }
    

    Once you’ve added the code snippet, you can use this short tag to your Menu as Title: {um_avatar}

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘profile add on menu with image feature’ is closed to new replies.