If you’re using JetFormBuilder to handle user registration, you might want to add user meta on JetFormBuilder Registration when a user registers — that is not possible with default submit action. Many time you want to change/modify the form submission date and add it to user meta or somewhere else in the database.
In this blog post, we’ll walk through how to add custom user meta after a JetFormBuilder register form is submitted, using a simple and effective PHP snippet.
How to add user meta on JetFormBuilder Registration Form
We need to enable “Add User ID to form data:” option in the Register User Post Submit Action.

We need to use “Call Hook Post Submit Actions”.

Need to add code according to the custom hook we just created earlier.
add_action( 'jet-form-builder/custom-action/update-registered-user-role', function () {
$data = jet_fb_context()->get_request();
if ( isset( $data['role'] ) && isset( $data['user_id'] ) ) {
// Get WP_User object
$user = new WP_User( $data['user_id'] );
// Optional: Validate role exists before assigning
$allowed_roles = array( 'supplier', 'factory', 'buyer' );
// Ensure role is valid and allowed
if ( in_array( $data['role'], $allowed_roles ) ) {
// Remove existing roles
$user->set_role( '' );
// Add new role
$user->add_role( $data['role'] );
}
}
}, 99 );Learn more about WordPress Customization on our blog.

