A Cozmoslabs Product
Documentation / Profile Builder Developer Knowledge Base / Custom Fields / Add meta to the user after successful registration

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' );
}

The Ultimate Membership Bundle

Combine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.

Get 25% off with the bundle

Help & Support

We’re here to help you every step of the way.

Open a Support Ticket