-
Author
-
July 24, 2017 at 12:49 #168407
Gavsta
ParticipantHi,
Is there a way to change how the redirect works when i use the built in kleo login module? It redirects to the home page currently, but i would like to redirect the user back to the previous page once they log in.
I saw that i can provide a custom URL for the redirection but the URL will change depending on which page the user is on.
context: On my pages for my venues, i split the events into new members and existing members. I have added the kleo login module to the section for existing members so they can log in without having to navigate away from the page. We have about 30 venues, so 30 possible pages that they could need redirecting to depending on where they are from.
Is this possible?
Thanks,
PhilB
July 24, 2017 at 22:58 #168490Laura
ModeratorHello, can you share access so i can check it out? 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 25, 2017 at 11:00 #168515Gavsta
ParticipantHi,
The site is on a development server at the moment. I can share the link to that and the page i am working on at the moment. There aren’t as many venues to work with there.
how do i send details? do i need to make a private reply?
As i mentioned in my other ticket, if i can get the redirect to go back to the page they were on then i wont need to hide the content (mentioned in the other ticket).
Thanks,
Phil
July 26, 2017 at 04:13 #168579Laura
ModeratorHello, yes please share as a private reply 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 26, 2017 at 12:07 #168625Gavsta
ParticipantHi Laura,
Not a problem. The site is located at http://lgtest.quadris.biz and the page i am working on is here: http://lgtest.quadris.biz/quadris-gc/
Its my staging server and can run a bit slow sometimes.
you can login with the following details
username: laura_kleo
password: VvtHRFq0gONBUn8pkNT64JSVI had some success with the login and redirection yesterday. I have the login box on that page, and now when you login it redirects you back to the correct tab.
Issues at the moment:
Admin’s are no longer taken to the administrators dashboard.
Also, the URL that is output doesn’t look very clean with pretty permalinks. AS it is now, the link is changed to include the tab’s ID. so the link ends up looking like this http://lgtest.quadris.biz/quadris-gc/#link_tab-existingIdeally i would like to omit that last part from the URL and just keep the venue’s permalink. That is probably me being fussy though, i imagine that if i removed that from the link then when redirected the tab wouldn’t be opened by default.
Function to perform redirect on login:
COPY CODEadd_filter( 'login_redirect', function ( $redirect_to, $requested_redirect_to, $user ) { global $user; if( isset( $user->roles) && is_array( $user->roles)) { if ( in_array( 'administrator', $user->roles)) { $redirect_to = admin_url(); return $redirect_to; } elseif ( ! $requested_redirect_to ) { $redirect_to = wp_get_referer(); return $redirect_to; } } ?> <?php if (is_user_logged_in()) : ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>">Logout</a> <?php endif; }, 10, 2 );Generally though Laura, the redirect is working now (yay!) but if you can offer any advice on fixing the administrator redirect part and if it’s possible to clean the URL up a bit. Or if there is a way to edit the tab names so that the output is quadris-gc/#existing and not /#link_tab-existing
Thanks for your time Laura,
PhilB
July 26, 2017 at 12:08 #168626Gavsta
ParticipantI forgot to tick ‘Private reply’ and cannot edit my previous post. Please could you set my response to private! Thanks,
Phil
July 26, 2017 at 22:09 #168694Laura
ModeratorHello, will assign the ticket to a higher support level who can help and advise you in your query.
Thanks! ?Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 27, 2017 at 11:08 #168732Gavsta
ParticipantHi,
Thanks Laura. Like i say it is near enough working, i’d just like to clean the URL up a bit. Also, i know that Kleo has a redirect option in the theme settings so i didnt know if there was a template tag or filter that would alter Kleo’s redirect function, if there is then even better.
I mean, that would have worked anyway but i have a lot of venue pages that i need to redirect to so i cant just set one page.
Anyway,
Thanks again Laura!
PhilB
July 31, 2017 at 12:54 #169099Gavsta
ParticipantHi,
I just wanted to update and let you guys know that the client has decided not to go for forcing users to login for certain parts of the website, so this is no longer needed so i wont be working on this. I’m happy to close the ticket and save you guys time.
Many thanks,
PhilB
July 31, 2017 at 19:57 #169166Radu
ModeratorHi PhilB,
Thank you for the infoHave a nice day
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
You must be logged in to reply to this topic.