Add meta to the user after successful registration

This function adds meta to the user after successful registration and email confirmation.

Make sure to:

  • change new_meta_name and new_meta_value in update_user_meta on line 9 and 15

wppb_register_success is for adding a meta after successful registration and is located in Profile Builder: /front-end/class-formbuilder.php

wppb_add_other_meta_on_user_activation is for adding a meta after successful email confirmation and is located in Profile Builder: /features/email-confirmation/email-confirmation.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
 * Add meta to the user after successful registration and email confirmation.
 */
add_action( 'wppb_register_success', 'wppbc_create_custom_id', 10, 3 );
function wppbc_create_custom_id( $request, $form_name, $user_id ) {
   if ( $user_id == '0' ) {
      return ;
   }
   update_user_meta( $user_id, 'new_meta_name', 'new_meta_value' );
}
 
// same thing for email confirmation
add_action( 'wppb_add_other_meta_on_user_activation', 'wppbc_create_custom_id_on_email_conf', 20, 2 );
function wppbc_create_custom_id_on_email_conf( $user_id, $meta ) {
   update_user_meta( $user_id, 'new_meta_name', 'new_meta_value' );
}

Profile Builder Pro

Create beautiful front-end registration and profile forms with custom fields. Setup member directories, custom redirects, cutomize user emails & more using the all in one user management plugin.

Unlock PRO Features

Or download FREE version