I found answer myself if this help any one please use so i post answer
set_transient function are save data for save old data and use it when send mail.
function sr_old_user_data_transient(){
$user_id = get_current_user_id();
$user_data = get_userdata($user_id);
$user_meta = get_user_meta($user_id);
foreach($user_meta as $key=>$val){
$user_data->data->$key = current($val);
}
// 1 hour should be sufficient
set_transient('sr_old_user_data_' . $user_id, $user_data->data, 60 * 60);
}
add_action('show_user_profile', 'sr_old_user_data_transient');
// Cleanup when done
function sr_old_user_data_cleanup($user_id, $old_user_data){
delete_transient('sr_old_user_data_' . $user_id);
}
add_action('profile_update', 'sr_old_user_data_cleanup', 1000, 2);
你覺得那裏的老數據去,一旦你已經改變了嗎? – flomei
我想發送這樣的郵件:你的舊角色是學生和新角色使用教師 – Sourabh
你可以添加一個鉤子到edit_user_profile_update並從那裏發送郵件。 – flomei