WordPress triggers a custom hook when certain meta is updated, user meta counts. See updated_{$meta_type}_meta
. Here’s an example use case:
add_action('updated_user_meta', function( $meta_id, $user_id, $meta_key, $_meta_value ) {
switch ( $meta_key ) {
case 'mobile_number':
case 'address':
$user = new \WP_User($user_id);
// user
wp_mail($user->user_email, 'Profile updated', 'Profile updated.');
// admin
wp_mail(get_bloginfo('admin_email'), 'Profile updated', "Profile updated for user {$user->display_name}.");
break;
}
}, 0, 4);
Related Posts:
- How to login with email only no username?
- Separate registration and login for different roles
- Disallow user from editing their own profile information
- What are the differences between wp_users and wp_usermeta tables?
- How can I send a welcome email to a user AFTER they login for the first time?
- Customize wp_new_user_notification_email()
- Login email after registration never sent or received
- Display sortable User meta column in admin panel user’s page
- Restricting frontend acess based on user role otherwise redirect to login form
- Right practice to edit WP reset password email
- Deny a user role to log in after register
- Private page protected with username and password
- How to integrate external user tables with WP?
- Allow Users Only Edit Their Profile?
- How can I change the email sender name from wordpress to (myblogname) on the “lost password” email?
- Set Default User Role
- Lock out all WordPress Administrators except two specific users
- Can’t log in. WordPress says my account doesn’t exist [closed]
- Why is wp-login trying to send an email?
- Invalidate username if it contains @ symbol
- WordPress Login redirection according to user role
- Prevent Subscriber Role to login
- Sending new registration meta values to admin by email
- Can I protect a type of content site-wide with a single password?
- Log in with email but no password
- How are all users now set to inactive?
- Login Based on ip
- How is it possible to current user info on page in WordPress?
- URL Restrictions? Need only people who are logged in AND have a specific role (or roles) to access all pages for a site
- Updated : how to make email optional while user registration using default wordpress form
- Custom failed login error messages for users based on user role?
- Custom user roles are unable to login
- WordPress does not send email confirmation to newly registered users
- confirmation email is send from my local host registration of a user but mail will not display in there email account?
- Check to see if there a wordpress user account and create one if not outside of wordpress
- Can i login with only one account to different top leveled domain wordpress web sites?
- Cant login, Password MUST be reset error, after reset
- generate an array of user login date using update_user_meta();
- In Django, how do I know the currently logged-in user?
- Can I programmatically login a user without a password?
- Can’t log in: “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”
- Is there any way to rename or hide wp-login.php?
- How can I redirect user after entering wrong password?
- Increase of failed login attempts, brute force attacks? [closed]
- Login page ERROR: Cookies are blocked due to unexpected output
- SSO / authentication integration with external ‘directory service’
- Preventing session timeout
- How reduce wordpress login session timeout time?
- How to prefill WordPress registration with social details
- Check for correct username on custom login form
- get_user_meta() doesn’t include user email?
- I can’t access my site via wp-admin
- ‘Password field is empty’ error when using autofill in Chrome
- Removing username from the ‘wordpress_logged_in’ cookie
- How to show ‘login error’ and ‘lost password’ on my template page?
- How do you update user_email on the front end in WP 3.3?
- Send user activation email when programmatically creating user
- What is $interim_login?
- Custom login form
- How to prefill the username/password fields on the login page
- wp_signon returns user, but the user is not logged in
- wp_update_user not updating
- Check if user is admin by user ID
- Adding extra authentication field in login page
- Prevent wp_login_form() from redirecting to wp-admin when there are errors
- Create custom user role (client) that can create another custom user role (employee) of that client
- Query users by custom taxonomy and user role
- Redirect user using the ‘wp_login_failed’ action hook if the error is ’empty_username’ or ’empty_password’
- wp_signon() does not authenticate user guidance needed
- What exactly is ReAuth?
- Login members using web services
- Make my wordpress blog remember my login “forever”
- How to check in timber if user is loggedin?
- How do I change the language of only the login page?
- How to change the email notification recipient (user) for new comments?
- Disable WordPress 3.6 idle logout / login modal window / session expiration
- Stop WordPress from logging me out (need to keep me logged in)
- Woocommerce registration page [closed]
- How to disable autocomplete on the wp-login.php page
- Share login data/cookies between multiple installations
- Synchronize WordPress user accounts across multiple domains and installations without using WordPress MU
- How to pass users back and forth using session data?
- How do I change the logo on the login page?
- Why does WordPress hide the reset password key from the URL?
- Is it possible to sign in with user_email in WordPress?
- Editing ‘Password Reset’ E-mail
- How to use current_user_can()?
- Avoid to load default WP styles in login screen
- WordPress registration message
- Grouping users under parent user
- How to fake a WordPress login?
- how to display the wordpress login and register forms on a page?
- Does wp_logout_url() destroy a session? (Logging out question)
- Can not login with correct username and password
- Website Visible only to Registered users
- Create un-removeable user
- How can i increase the login expiration length?
- How do I use add_action from a class method?
- How to remove the WordPress logo from login and register page?
- How can I add a custom script to footer of login page?