Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Plugin update first_name, last_name in wp_usermeta on activation


peterverkooijen
Participant

@peterverkooijen

Thanks for the additional clues DJPaul!

In the latest attempt I was going back to my first approach, trying to catch the input straight from the form, so that has to run on initial user registration, not on activation.

Or is user_register not used in Buddypress at all? Is there a wpmu or bp equivalent I could try? Should I use wpmu_create_user? According to this blog post:

the do_action for wpmu_new_user is directly at the bottom of wpmu_create_user in the wp-includes/wpmu-functions.php the wpmu_create_user gets sent the username password and email and checks if the username or email exists, if not create the new user in the database and assign a user_id to the return, also assigning capabilities and level … this happens on *all* levels of registration and is the perfect hook point to add them into the database

the do_action do_action( ‘wpmu_new_user’, $user_id ); so you get the immediate user_id soon as it’s created which you can use in your table

Apparantly this is like a flowchart of registration events in wpmu (wp-includes/wpmu-default-filters.php):

add_filter ( 'wpmu_validate_user_signup', 'signup_nonce_check' );
add_action ( 'init', 'maybe_add_existing_user_to_blog' );
add_filter ( 'xmlrpc_methods', 'attach_wpmu_xmlrpc' );
add_filter ( 'wp_authenticate_user', 'wordpressmu_authenticate_siteadmin', 10, 2 );
add_action ( 'wpmu_new_user', 'newuser_notify_siteadmin' );
add_action ( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
add_action ( 'sanitize_user', 'strtolower_usernames', 10, 3 );

Should I focus on these wpmu action hooks instead of regular wp hook? Does bp have a list like this somewhere?

I couldn’t figure out how to serialize that $meta data and extract the fullname from it, so I abandoned the approach hooking into wpmu_activate_user for now. Also when I put in the $user_id and $password arguments I got the error messages about missing arguments. wtf?!

I think this bit of code grabs the input from the registration form:

$fields = BP_XProfile_Field::get_signup_fields();

if ( $fields ) {
foreach ( $fields as $field ) {

$value = $_POST['field_' . $field->id];

fullname is the input from field_1, but I don’t know how to finish the php to get to $fullname = … . The two latest attempts above did not work.

I have to give up for now. Deadline at my day job coming up…

Skip to toolbar