Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'login_redirect' native filter not firing #839

Closed
talamihg opened this issue Dec 7, 2021 · 3 comments
Closed

'login_redirect' native filter not firing #839

talamihg opened this issue Dec 7, 2021 · 3 comments
Assignees

Comments

@talamihg
Copy link

talamihg commented Dec 7, 2021

Hi wp-auth0 developers,

I am currently using WordPress version 5.7.3 and wp-auth0 version 4.2.0. The login method I am using is the universal login page since it is a little nicer, more secure, and has fewer problems with cross-domain SSO. I would like to use WordPress's native filter login_redirect to redirect a user after authentication, based on their user role and if any 'redirect_to' links were clicked. I am noticing that this filter does not get triggered at all after authentication, and the hook is bypassed altogether.

apply_filters( 'login_redirect', string $redirect_to, string $requested_redirect_to, WP_User|WP_Error $user )

https://developer.wordpress.org/reference/hooks/login_redirect/

Is wp-auth0 working as intended in this instance? Is there another way to grab in code the $user and $redirect_to values after login? From what I have read on the community forums if the login method was changed from universal to embedded that filter would fire, but I would like to continue to use the hosted page if possible.

Many thanks!

Related issue (closed): #330

@evansims evansims self-assigned this Dec 10, 2021
@evansims
Copy link
Member

Hey @talamihg 👋 Thanks for your report!

At the moment, it does not appear we implement that particular filter hook, as you noted; we just offer the 'Login Redirection URL' option inside the Advanced section. I do not believe we currently offer a means of retrieving both of those particular values upon login.

In regards to the login redirect filter, I can't think of any particular reason this couldn't be supported offhand, if you'd like me to add this as a feature request to our backlog, or community PRs are always appreciated.

@talamihg
Copy link
Author

talamihg commented Dec 14, 2021

Hey Evan,

Thanks for checking into this. I think adding this request to the backlog as a feature request would be best. I'm unfamiliar with the wp-auth0 project and I think you all would handle coding this feature better. If I do get around to submitting a PR, it would be a nice surprise, and I could tag this issue (#839).

That would be great to include and it would increase compatibility with other plugins out there. For example, I had tested my scenario with this plugin LoginWP (Formerly Peter's Login Redirect) (https://wordpress.org/plugins/peters-login-redirect/) and noticed it failed to work. Upon inspecting its codebase I noticed it uses the login_redirect hook as well on line 12. https://plugins.trac.wordpress.org/browser/peters-login-redirect/trunk/src/core/src/Redirections/Redirections.php

This would be nice to include for custom functions but also compatibility with other plugins out there.

Many thanks!
- Harry

@evansims
Copy link
Member

Thanks, @talamihg. 👋 I agree that this would be a nice event for us to hook into. It will be a little bit before I'm able to dive into this, but I've added it to our backlog to be added in the next minor release. In the meantime if you happen to get to creating a PR for it, that would be most welcome too! Thanks again!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants