You can use edit_user_profile_update
hook.
This action hook is generally used to save custom fields that have been added to the WordPress profile page.
add_action( 'edit_user_profile_update', 'update_extra_profile_fields' );
function update_extra_profile_fields( $user_id ) {
if ( current_user_can( 'edit_user', $user_id ) ) {
update_user_meta( $user_id, 'my_custom_field', $_POST['your_field'] );
}
}
With update_user_meta
you can check the response of each custom field while saving that is it new or same as before.
Meta ID if the key didn’t exist; true on successful update; false on failure or if $meta_value
is the same as the existing meta value in the database.
You can crate a new table for log or use posts table with new post type user_log
and display entries in back-end.
You can also try the WP Security Audit Log plugin.