• Resolved spikespiegel

    (@spikespiegel)


    Before installing ultimate member, this was the code that I was using in my functions.php to allow the user to access his wordpress profile:

    function contributor_profile($atts)
    {
        if (is_user_logged_in() && !is_feed()) {
            $userdata = get_userdata( get_current_user_id() );
            return '&nbsp;<span class="profile"><a href="' . admin_url('profile.php') . '">' . ( 'Edit Profile' ) . '</a></span>';
        }
    }
    add_shortcode('contributor_profile', 'contributor_profile');

    But after installing Ultimate Member, the code is only working with the admin account.
    I’d like to know how to achieve the same result using Ultimate Member, can you help me out?

    • This topic was modified 3 years, 11 months ago by spikespiegel.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @spikespiegel

    You need to enable the user role to access the WP Admin.

    Please go to WP Admin > Ultimate Member > User Roles > edit that particular role > see “Administrative Permissions” > check “Can access wp-admin?”.

    Regards,

    Thread Starter spikespiegel

    (@spikespiegel)

    Isn’t there another way? Can I just create a direct dynamic link to “user profile” page or to the edit “user profile” page?

    Thread Starter spikespiegel

    (@spikespiegel)

    I mean a menu link that leads to user profile in ultimate member, not in wp-admin.

    Thread Starter spikespiegel

    (@spikespiegel)

    I also tried activating the option you said, it didn’t work.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @spikespiegel

    You can try this code snippet to create a link to UM Profile page:

    function contributor_profile($atts)
    {
        if (is_user_logged_in() && !is_feed()) {
             $url = um_user_profile_url( get_current_user_id()  );
    
            return '&nbsp;<span class="profile"><a href="' . $url . '">' . ( 'Edit Profile' ) . '</a></span>';
        }
    }
    add_shortcode('contributor_profile', 'contributor_profile');

    If you want to open the Edit UM profile instead of redirecting it to the UM Profile page, just add this in the URL ?um_action=edit.

    Regards,

    Thread Starter spikespiegel

    (@spikespiegel)

    Thannnnnnnnnnnnnnnnnks dude!!!! I love you!

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @spikespiegel

    Thanks for letting us know. I am closing this thread now.

    Regards,

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Get user profile with functions.php’ is closed to new replies.