Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using BuddyPress 2 registration and activation for three different sites with my own registration form. To know where the user has registered, I add the user meta key registered_from at registration. Is there a way to redirect the user after activation to the site where he registered?

share|improve this question

closed as off-topic by toscho Aug 2 at 20:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

Paste this code in your bp-custom.php file or, if you prefer, your active theme's functions.php file:

add_action( 'bp_core_activated_user', 'wpse_70289_activated_user_redirect' );

function wpse_70289_activated_user_redirect( $user_id ) {
    $registered_from = get_user_meta( $user_id, 'registered_from', true );
    wp_redirect( $registered_from );
}

I haven't tested this code myself yet, but it should work just fine.

References:

share|improve this answer
    
Thank you.Its not working here, but you gave me a good direction. –  Paul Oct 29 '12 at 11:02
    
@Paul - If it's not working, you could try using wp_safe_redirect() instead of wp_redirect(). I've updated my answer. –  bungeshea Oct 29 '12 at 19:56
    
Is my answer still not working? Is there any way I can improve it? –  bungeshea Dec 11 '12 at 6:27

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