Hi @rumesh38,
I thought to do that, but I don’t wanted to have duplicate row in database. I wrote a solution without touch the plugin code, I used the action hook ‘user_registration_after_register_user_action’ that “User Registration” has built-in:
/**
* USER REGISTRATION / Save data in Custom Field
* This function allow to save the data of a field from "User Registration" form
* to a custom field you already have in your site and then delete the database row
* that "User Registration" created to avoid duplicate rows. Following the same workflow,
* you can setup all the fields you need.
*/
// Preparing the function to trigger when user registrate throught "User Registration" form
function mytheme_update_fields_from_user_registration( $form_data, $form_id, $user_id) {
// Check the ID of Form to trigger the code for a particular form
// You can get the ID from shortcode: [user_registration_form id="150"]
if($form_id == 150) {
// Get data from 'user_registration_user_phone' field just created
$user_phone = get_user_meta($user_id, 'user_registration_user_phone', true);
// Update our custom field from "User Registration" field
update_user_meta($user_id, 'user_phone', $user_phone);
// Delete the data of "User Registration" field
delete_user_meta($user_id, 'user_registration_user_phone');
}
}
// Trigger the function when a user registrate throught "User Registration" form
add_action( 'user_registration_after_register_user_action', 'mytheme_update_fields_from_user_registration', 10, 3 );
Cheers!
EDIT: This code should be save in function.php or even better in a custom plugin. ??