2
votes

I have set up a custom registration plugin on my wordpress installation. The problem is that although it works perfectly when I do

/wp-admin.php?action=register

When I attempt /register I get redirected to the buddypress plugin registration page. I disabled this by adding

remove_action( 'bp_init', 'bp_core_wpsignup_redirect' );  
remove_action( 'bp_screens', 'bp_core_screen_signup' );

in my functions.php but now when I try to visit /register I get to the default registration page of wordpress and my plugin is ignored.

This is what I use to redirect to my custom plugin:

add_action('login_form_register',  array($this,'redirect_to_custom_register'));

   public function redirect_to_custom_register()
{

    if ('GET' == $_SERVER['REQUEST_METHOD']) {
        if (is_user_logged_in()) {
            $this->redirect_logged_in_user();
        } else {
            wp_redirect(home_url('member-register'));
        }
        exit;
    }
}

Any ideas why?

2
Have you tried disabling the buddy press plugin to see if it works with it disabled? - NaijaProgrammer
Yes if I disable buddy press it works as expected - idipous

2 Answers

1
votes

"Yes if I disable buddy press it works as expected". Then, you have to go into the buddypress settings page and change the registration page to other than 'register', since buddypress automatically sets its registration page to '/register'. Create a new page, set the buddypress registration page to that new page, and your '/register' page will be free for your custom registration.

1
votes

I would like to just add that I have found the code you mentioned (to disable the buddypress redirect) all over the place, and it is outdated.

I found this code which now works. I am using buddypress 2.9.2, the most current version.

    // disable BuddyPress redirect from default reg page
function my_disable_bp_registration() {
  remove_action( 'bp_init',    'bp_core_wpsignup_redirect' );
  // remove_action( 'bp_screens', 'bp_core_screen_signup' );
}
add_action( 'bp_loaded', 'my_disable_bp_registration' );
add_filter( 'bp_get_signup_page', "firmasite_redirect_bp_signup_page");
function firmasite_redirect_bp_signup_page($page ){
    return bp_get_root_domain() . '/wp-signup.php';
}

Just wanted to add this to help anyone who is currently having this issue :)