redirect login page

This topic contains 17 replies, has 5 voices, and was last updated by  bernieportal 6 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #450994

    bernieportal
    Expired Member
    Post count: 108

    Is there a way to redirect where the page goes after I login to my dashboard? Currently when I login it redirects me to my directory home page and I’d like it to link to my author page.

    #451002

    Kor
    Moderator
    Post count: 16516

    Hi Sarah,

    Thanks for your post. Kindly refer to this section of the documentation and see if it helps. https://wpgeodirectory.com/docs/redirecting-the-login-page/

    Thanks!

    #451009

    bernieportal
    Expired Member
    Post count: 108
    This reply has been marked as private.
    #451015

    Alex Rollin
    Moderator
    Post count: 27815

    Please share the snippet you have used here and we will take a look to see if it is ok.

    #451017

    bernieportal
    Expired Member
    Post count: 108
    This reply has been marked as private.
    #451019

    Kor
    Moderator
    Post count: 16516
    This reply has been marked as private.
    #451051

    Patrik
    Moderator
    Post count: 1971

    Hi Sarah,

    Kindly share the FTP details in private reply so that we can look more into this issue.

    Regards,
    Patrik

    #451105

    bernieportal
    Expired Member
    Post count: 108
    This reply has been marked as private.
    #451109

    Kor
    Moderator
    Post count: 16516

    Hi Sarah,

    Thanks for your reply. Yes, an FTP access. You can contact your hosting provider and ask them to create one for you.

    Thanks!

    #451113

    bernieportal
    Expired Member
    Post count: 108
    This reply has been marked as private.
    #451212

    Kiran
    Moderator
    Post count: 7069

    Hello,

    Try this snippet to redirect to author page after login.

    
    
    // Login redirect to specific url.
    function _gd_snippet_login_redirect_to_author( $redirect_to, $requested_redirect_to, $user ) {
        // Only modify the redirect once the user is logged in
        if ( ! is_a( $user, 'WP_User' ) ) {
            return $redirect_to;
        }
    
        // If a 'redirect_to' parameter has been passed that contains 'wp-admin'
        if ( ! empty( $redirect_to ) && false !== strpos( $redirect_to, 'wp-admin' ) && user_can( $user, 'edit_posts' ) ) {
            return $redirect_to;
        }
    
    	$author_link = geodir_getlink( get_author_posts_url( $user->ID ), array( 'geodir_dashbord' => 'true' ), false );
    	$author_link = apply_filters( 'gd_dash_listing_author_link', $author_link, $user->ID );
    	$author_link = geodir_getlink( $author_link, array( 'stype' => 'gd_place' ), false );
    	$redirect_to = apply_filters( 'geodir_dashboard_link_my_listing', $author_link, 'gd_place', $user->ID );
    
        return $redirect_to;
    }
    add_filter( 'login_redirect', '_gd_snippet_login_redirect_to_author', 100, 3 );

    Kiran

    #451222

    bernieportal
    Expired Member
    Post count: 108

    Thanks. It said there was an error on line 5. Syntax error, unexpected ‘return’ (T_RETURN).

    #451225

    Patrik
    Moderator
    Post count: 1971

    Hi Sarah,

    Where did you put the code? I can’t find it in the functions.php of the currently active theme. It should be added there. I have added the same code there and it should work. Please remove your code. Let me know if it works for you or not.

    Regards,
    Patrik

    #451234

    bernieportal
    Expired Member
    Post count: 108

    what you added works. However, it’s linking to the author page of the Places CPT and I’d like it to link to the author page of another CPT I added: “Broker.” Where/how can I change that?

    #451273

    Kiran
    Moderator
    Post count: 7069

    In snippet change “gd_place” to CPT you want.

    You will find it in two lines

    
    
    $author_link = geodir_getlink( $author_link, array( 'stype' => 'gd_place' ), false );
    $redirect_to = apply_filters( 'geodir_dashboard_link_my_listing', $author_link, 'gd_place', $user->ID );

    Kiran

Viewing 15 posts - 1 through 15 (of 18 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount