You can put it in your theme or child-theme functions.php or in bp-custom.php.
Fantastic. Thx!
How/when does WP execute it?
or, if this was a plugin, where would i place this code?
activate_redirect_after_register
or
run_redirect_after_register
?
i’m guessing this part should go in the ‘activate’ function
add_action(‘bp_core_signup_user’, ‘bp_redirect’, 100, 1);
and everything should go in the ‘run’ section. Correct?
thx!
Update: i put the code into bp-custom.php. Not quite working.
It is getting redirected– but i’m not getting the page i entered into bp-custom.php. I’m getting redirected to the WP login screen.
So the code is doing something. But not redirecting right.
Any ideas?
(you can forget about plugin question, just want to make the code work).
thx!
Can you paste the code you’re using here?
i’m trying to post the code, but i cannot see my posts here
will try to post this bit by bit.
this code is in “plugins\my-redirect.php”. The plugin is activated.
<?php
/*
Plugin Name: Redirect After Register
Plugin URI: http://laptopacademy.net
Description: Redirect after user registration.
Version: 1.0.0
Author: John Weiss
Author URI: http://laptopacademy.net/wordpress/instructor
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Text Domain: redirect-after-register
Domain Path: /languages
*/
function bp_redirect($user) {
$redirect_url = 'http://www.mysite.com/yeah';
bp_core_redirect($redirect_url);
}
add_action('bp_core_signup_user', 'bp_redirect', 100, 1);
?>
this thread says bp_core_signup_user does not work:
https://wordpress.org/support/topic/how-to-hook-into-add-new-member-in-buddypress
the weird thing is, it’s doing something (because it goes to the login page with the hack, and to the activation page without the hack).
So i think bp_core_signup_user is working. The issue appears to be bp_core_redirect.
Paul Gibbs, Keymaster, suggests bp_core_redirect might get called in the wrong place– “too high up in the stack”. The OP also mentions that wp_redirect
works, and in fact wp_redirect works for me.
So, unless there’s some special reason why i should not use wp_redirect, that’s my fix.
why does bp_core_redirect even exist, if wp_redirect is available? I assume it has some special function that wp_redirect cannot do. right?
any ideas why it doesn’t work in this scenario? Maybe something wrong with those parameters i’m passing it, 100 and 1? What are those params? Where can i find documentation for bp_core_redirect? can’t find…..
many thx
update, i tried bp_core_redirect without any params– still does not work. I suspect maybe it only works when a user is logged in?