• marktrader

    (@marktrader)


    Hello

    I’m trying to set the author archive as the user’s profile page. So when my user’s log in, they are sent to their Author archive, instead of the profile & account page.

    1) How can I create a link to add to the nav menu/button
    2) On the user’s account page, there’s a link to their profile page, how can I replace this with the logged in user’s Author archive?

    Any help would be awesome.

    Thanks!

    • This topic was modified 5 years ago by marktrader.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @marktrader

    1. You can try this URL to your nav menu: yoursitedomain.com/user/
    We will redirect the User to the archive page when they visit that URL.
    2. Here’s the code snippet that you need to redirect the user to the archive page when they visit the /user/ page:

    add_action("template_redirect","um_080521_redirect_from_profile", 99999 );
    function um_080521_redirect_from_profile(){
    
        if( function_exists("um_is_core_page") && um_is_core_page("user") || is_page("user")  ){
            $user_id = um_get_requested_user();
            if( is_page("user") && ! $user_id ){
                $user_id = get_current_user_id();
            }
            $redirect_url = get_author_posts_url( $user_id );
            wp_redirect( $redirect_url ); exit;
        }
    }

    You need to change the “user” in the code is_page("user") to match your User Page’s slug. if the page slug is the same, then leave it.

    Regards,

    Thread Starter marktrader

    (@marktrader)

    Thank you @champsupertramp !! This works perfectly.
    Reakky appreciate the help.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Using Author archive as member profile’ is closed to new replies.