Redirect users to Welcome page after successful registration on your BuddyPress based Social Network
Today, Angus asked me this question via mail. He wanted to redirect users to a thank you page after successful registration on the BuddyPress site. This post will help you if you are looking for the same.
On a BuddyPress site, when a new user registers, and if the registration is successful, they are shown the text( I haven't seen many people modifying that text ) as below.
You have successfully created your account! To begin using this site you will need to activate your account via the email we have just sent to your address.
Now, you can either modify that content by editing register.php file or a better option is to redirect them to another page where you can put all the information for them to get started with your site.
In the code below, I am redirecting user to a site.com/welcome page on successful registration, you can change that to any other page.
1 2 3 4 5 6 7 8 | add_action( 'bp_complete_signup', 'buddydev_redirect_after_signup' ); function buddydev_redirect_after_signup() { $page = 'welcome';//your page slug bp_core_redirect( site_url( $page ) ); } |
Please put the code in your bp-custom.php and make sure to create a page with the slug 'welcome' or whatever page slug you have changed.
After that, try registering a new account and you will see the magic.
Hope this little snippet helps you 🙂
Where Is The bp-custom.php file located?
Hi Brandon,
The bp-custom.php should be created in your wp-content/plugins directory.
This link may help you understand it.
https://buddydev.com/docs/guides/guides/buddypress-guides/what-is-bp-custom-php/
Regards
Brajesh
Hi,
It's not working, I'm using this in bp-custom and in functions.php and nothing happen. I'm still redirected to wp-admin
Can you help me ?
Hi Nicolas,
I am sorry, It's a delayed reply. Do you still need help with this?
Not working here too . . . .
Sorry about that. Most probably some other code or plugin is conflicting. Please post in our forum to allow us help you better.
Thank you.