If you have WPMEMBER plugin installed and you are looking to redirect your registered users to a different url than the “Dialog Box” display, then you can use this snippet. It hooks into wpmem_register_redirect() function.
add_action( 'wpmem_register_redirect','the_reg_redirect' );
function the_reg_redirect()
{
// NOTE: this is an action hook that uses wp_redirect
// wp_redirect must end with exit();
wp_redirect( 'http://youredirecturlhere.com' );
exit();
}
Simply add this function to your child-theme functions.php file, and that’s it!
I just want to say you THANK YOU!!!! Thanks to you find the proper, effective and elegant solution after 10 days of dreamless nights of testing doing myself 😀
Best regards
John
PS: Sorry for my english, not born speaker 🙂
PPS: Website still uder construction.
PPPS: Missing quote starting URL 😉
Glad you found it helpful.
updated typo 🙂
Awesome, thank you! I tried so many solutions and this worked out the best and easiest. Thanks!
You are welcome.
I’m wondering if it would be possible to customize this per page. In general, I want users to get to a protected page, see the login form, log in and then be directed to the page they were trying to get to. That is working fine.
But when someone goes to the Member Login page first, I would then like them to be directed to a different page, rather than just staying on the login page. So, is there a way to make the redirect only apply to one page, the login page?
sure is:
I use WP-Members to protect content on my site. I have several pages blocked, so that when they are loaded the existing users login form appears.
Now, most users who hit these pages are first time users, so they must click on the “Click here to register link” before the form. This drives them on to the user registration page/form.
Once they’ve registered, I’d like to be able sent them directly to the specific content page they accessed at the very start. Is there any way to do that?
This would take a little bit more customization that the normal. However, a quick hint, if you want to give it a shot, would be to figure out what the referring url is that the visitor is coming from… once you have this, then you can just save it to the current session… once in the session you can do whatever you want with it, including, sending your user back to the page they came from ????
Is there a known solution for this yet?
Could you explain what issue you are looking at… the soltion may have already presented itself.
Thanks, Ray. Any idea what the CSS would look like in that case and where would it be placed?
not quite sure, as every site is different in styles, moreover, you would place the php code within the functions.php file of your child-theme 🙂
Hello.This article was really fascinating, especially because I was looking
for thoughts on this topic last Tuesday.
Wonderful solution, this was really helpful. Thanks a lot.
Hi.
How can I do to redirect to the same page the users were trying to get to, not a specific page like the “http://youredirecturlhere.com” sample?
Like: User go to http://www.sample.com/blog/1 then log in and not to http://www.sample.com/blog/user-profile... to the initial http://www.sample.com/blog/1
Thank you vry much!
Hello Fernando,
You would need to capture the referring url, store it, then use it as the redirect variable.
Hint: maybe use this $_SERVER[‘HTTP_REFERER’]
Hope this points you in the right direction.
I tried this but still couldn’t get it to work. After user login, there is no redirect at all. It just sits on the user login page that welcomes the user.
This little code snippet is applied to the user registration, and not the user login.
Hello, today I came across this beautiful plugin. The plugin works great, but I have a problem with redirection after New user Registration. I have tried the solution which is mentioned. But none of them is working for me. Could you please help me out
Could you show me what you have thus far? Or could you give me a little more specific detail as to what you are expecting to happen and what you are experiencing as well?