How can admins to be notified of changes when users change their WP profiles?

I'm using the code below that I found in another thread. When a user makes changes to their profile, this snippet sends an email notification that something has been changed. I'd like to amend this so that we can be notified which fields specifically (Name, email, phone, etc) have been changed. Is there a simple way to achieve this by amending this code?

I'm pretty new to php and coding i general so please explain like I'm dumb. Thank you so much

add_action( 'personal_options_update', 'notify_admin_on_update' );
add_action( 'edit_user_profile_update','notify_admin_on_update');
function notify_admin_on_update(){
    global $current_user;
    get_currentuserinfo();

    if (!current_user_can( 'administrator' )){// avoid sending emails when admin is updating user profiles
        $to = '[email protected]';
        $subject = 'user updated profile';
        $message = the user :  .$current_user-display_name .  has updated his profile with:\n;
        foreach($_POST as $key = $value){
            $message .= $key . : . $value .\n;
        }
        wp_mail( $to, $subject, $message);
    }
}

Topic wp-mail notifications users Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.