redirect login page
This topic contains 17 replies, has 5 voices, and was last updated by bernieportal 6 years, 12 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: snippet
-
AuthorPosts
-
October 23, 2018 at 3:52 pm #450994
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.
October 23, 2018 at 4:24 pm #451002Hi 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!
October 23, 2018 at 4:36 pm #451009This reply has been marked as private.October 23, 2018 at 4:59 pm #451015Please share the snippet you have used here and we will take a look to see if it is ok.
October 23, 2018 at 5:06 pm #451017This reply has been marked as private.October 23, 2018 at 6:31 pm #451019This reply has been marked as private.October 24, 2018 at 6:24 am #451051Hi Sarah,
Kindly share the FTP details in private reply so that we can look more into this issue.
Regards,
PatrikOctober 24, 2018 at 1:57 pm #451105This reply has been marked as private.October 24, 2018 at 2:20 pm #451109Hi Sarah,
Thanks for your reply. Yes, an FTP access. You can contact your hosting provider and ask them to create one for you.
Thanks!
October 24, 2018 at 2:53 pm #451113This reply has been marked as private.October 25, 2018 at 1:18 pm #451212Hello,
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
October 25, 2018 at 2:17 pm #451222Thanks. It said there was an error on line 5. Syntax error, unexpected ‘return’ (T_RETURN).
October 25, 2018 at 2:35 pm #451225Hi 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,
PatrikOctober 25, 2018 at 2:53 pm #451234what 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?
October 26, 2018 at 4:18 am #451273In 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
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket