0

on EE 2.x the Freemember addon allowed to directly redirect the user after login/logout to a specified page (avoiding the default login/logout confirmation page).

Since the Freemember addon is EOL, how can I achieve the same thing on EE 5.x ?

New contributor
pete19 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

Not sure it's really possibly without editing core files at this point. I don't have time to test this, but I'll throw out a small guess based on hooks.

For login, you'd need to try one of these hooks:

member_member_login_multi($hook_data)
member_member_login_single($hook_data)
member_member_login_start()

I'm guessing the first two hooks occur after the splash page, so that's out. If not, that could be a key place to take over control with an extension and see where you can go from there.

The last hook is going to happen probably before the splash page and before the user is logged in, so what you'd have to do is (if it's possible) scrap the $_POST data for login info, and then instantiate the auth class, and log in the member yourself (provided you can even still do this in EE 5.X). You can always try this:

ee()->load->library('auth');
$sess = ee()->auth->authenticate_username("my_test_user", "my_test_pass");
var_dump($sess); 

somewhere to see if you can even still do that. If you can, you can take control with the member_member_login_start() hook and then redirect, and die() at the end of it.

For logout; I'm too tired to type up any more, but similar ideas. Test the log out hooks, and if you can take control of one before it hits the splash screen (and you have the where withall to properly log the user out with you're own code and the auth and/or session library) you can redirect there most likely.

Caution with this one if you proceed. Make sure members are fully logged in and out if you take control of auth and session.

Also, this may break the basic auth loop (bad password? try again; bad user? try again; too many log in attempts? wait a while; etc...).

  • 1
    thank you, I used member_member_login_single($hook_data) in a custom extension to get this done, but cannot vote this as correct answer as I don't have enough rep – pete19 2 days ago
0

A cruder but effective work-around (instead of rolling an add-on) is simply to submit the login form via an AJAX call and do the redirect to where ever via javascript. The login activity will still trigger the splash screen, but it won't be visible / shown to the user.

HTH

  • I assumed the question was in reference to Control Panel logins, not front-end logins. But even still, this is an intriguing approach. It would also be complex and have to handle (if even possible) the auth loop (bad password, too many login attempts, etc..). – jrothafer 8 hours ago

Your Answer

pete19 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.