Description
This action hook fires when a user is saved.
This action allows you to hook in after the form saves data to a new or existing user, making it useful to perform additional functionality when adding or updating your users.
Parameters
do_action( 'frontend_admin/save_user', $form, $user_id );
- $form (array) The form settings, including $form[‘record’][‘user’] which contains all of the submitted user fields’ data.
$user_id
(int|string) The ID of the user being edited.
Examples
Send email after user is saved.
This example demonstrates how to send an email after the user has been saved. Place this in your functions.php or a dedicated code snippets plugin.
functions.php
add_action('frontend_admin/save_user', 'my_fa_save_user', 10, 2);
function my_acff_save_user( $form, $user_id ) {
$user = get_user_by('ID',$user_id);
//get important fields
$user_email = $user->user_email;
$username = $user->user_login;
$address = get_field('postal_address', 'user_' .$user_id);
if( $address ) {
$email_sent = wp_mail( $user_email, 'Welcome '.$user_title, 'Please confirm your address: '.$user_content );
}
}