目前,当用户使用以下工具更新信息时,我可以向管理员发送电子邮件(连接到S2Memeber插件):
// Email to tell us what user profile for CMM has been modified
add_action (\'ws_plugin__s2member_during_handle_profile_modifications\', \'email_profile_changes\');
function email_profile_changes($vars = array()) {
$user = new WP_User($vars[\'user_id\']);
add_filter(\'wp_mail_content_type\', \'wpdocs_set_html_mail_content_type\');
$old_meta = get_user_meta($user->ID);
$to = "[email protected]";
$subject = "Profile Update - $user->user_login";
$body = "This user has updated their CMM profile information, here is their new profile data for audit purposes: <br/>" .
"<hr>" .
"First Name: " . $user->first_name . "<br/>" .
"<hr>" .
"Last Name: " . $user->last_name . "<br/>" .
"<hr>" .
"Email Address: " . $user->email . "<br/>" .
"<hr>" .
"Address: " . $user->wp_s2member_custom_fields[\'company_address\'] . "<br/>" .
"<hr>" .
"Telephone Number: " . $user->wp_s2member_custom_fields[\'telephone_number\'] . "<br/>" .
"<hr>" .
"Old User Data";
wp_mail ($to, $subject, $body);
remove_filter( \'wp_mail_content_type\', \'wpdocs_set_html_mail_content_type\' );
}
出于审计目的,有人问我是否可以在更新之前显示他们的用户信息以及他们更改的数据?
我将如何修改此文件以实现此目的?我假设wordpress数据库在保存时会覆盖此数据,因此不可能?
如果您能帮忙确定是否可行,我们将不胜感激?