How to hook into Add New Member in BuddyPress

I have a hook into the WordPress Add New User process via an add_action('user_register', 'doMyFunction'); hook.

What results is that I am (Step 1) adding a new user through WordPress and then (Step 2) having to add the same user to BuddyPress in order to get the user fully activated in WP/BP with the proper role.

Read More

I would prefer to just add a new user/member once through the Buddy Press Add User page and have it go through my hooked function.

Is there a Buddypress hook I should change too on the hook I show above in order to eliminate the 1st step described in my process?

Thanks for helping.

Expanding for better clarity

We do not use the BuddyPress signup process. We (as an Admin) setup new users ourselves. The reason is we have our own login authentication system that all users must pass through.

So I have hooked into WP’s add_user in order to (1) programmatically capture the user id I am creating and write it externally to our authentication systems’ list of vald users and (2) send a custom email to the user newly created.

Then I have to go into the BuddyPress admin page and setup the new user again so I can assign their role and let BP know they are good to go.

I would much rather hook right into BuddyPress’ add new user and do my external write and launch my custom email. I have tested and I know that the Add New User in BP adds it to WP as well.

I just don’t know what BP’s hook is — the one comparable to WP’ s add_user.

Hope that clarifies.

Related posts

Leave a Reply

2 comments

  1. In order to get the user id when a user is registered, hook into bp_core_signup_user:

    add_action('bp_core_signup_user', 'doMyFunction', 10, 5);
    
    function doMyFunction($user_id, $user_login, $user_password, $user_email, $usermeta){
        //do stuff
    }
    

    It supplies the user id as the first parameter.

  2. Mainly to help anyone that looks here and tries to take away that bp_core_signup_user is the solution…well, it isn’t (at least for me in what I am trying to accomplish).

    In my plugin I simply replaced:
    add_action('user_register', 'rebuildAuthUsers'); // rebuild the authorized user list anytime a new user is created through WordPress

    with:
    add_action('bp_core_signup_user', 'rebuildAuthUsers'); // rebuild the authorized user list anytime a new user is created through BuddyPress

    It did not intercept the registration process and launch my function.

    Still digging…