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 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.

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.

share|improve this question
    
Why are you not adding the user directly in BP as it automatically synchs with WP? –  KalenGi Jul 25 '12 at 18:35
    
I need to get in the process @kalengi because I capture the user id and write to a flat file for other purposes. –  frank13 Jul 25 '12 at 18:41
add comment

2 Answers

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.

share|improve this answer
    
Hmm, my question is not worded well if it generates that solution @kalengi. I am adding to it in the original question for better clarity. Give me a moment to post. –  frank13 Jul 25 '12 at 19:10
    
Hey @kalengi, let me know if you have a solution here. Thank you very much. –  frank13 Jul 26 '12 at 17:37
    
How do you add the user in the BP admin page? –  KalenGi Jul 26 '12 at 19:41
    
See my revision to my initial question above @kalengi. Thanks. –  frank13 Jul 26 '12 at 20:07
    
What I mean is: Which menu options do you click to get there? Can't seem to locate any BP admin page that adds users. –  KalenGi Jul 26 '12 at 20:13
show 5 more comments

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...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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