Commit ea0f102c authored by Gábor Hojtsy's avatar Gábor Hojtsy

#174224 by kkaefer: send user notification email after the user object is updated

parent bfe2229b
......@@ -193,11 +193,6 @@ function user_save($account, $array = array(), $category = 'account') {
$user_fields = user_fields();
if (is_object($account) && $account->uid) {
user_module_invoke('update', $array, $account, $category);
if (isset($array['status']) && $array['status'] != $account->status) {
// The user's status is changing, conditionally send notification email.
$op = $array['status'] == 1 ? 'status_activated' : 'status_blocked';
_user_mail_notify($op, $account);
}
$query = '';
$data = unserialize(db_result(db_query('SELECT data FROM {users} WHERE uid = %d', $account->uid)));
foreach ($array as $key => $value) {
......@@ -252,6 +247,14 @@ function user_save($account, $array = array(), $category = 'account') {
// Refresh user object
$user = user_load(array('uid' => $account->uid));
// Send emails after we have the new user object.
if (isset($array['status']) && $array['status'] != $account->status) {
// The user's status is changing, conditionally send notification email.
$op = $array['status'] == 1 ? 'status_activated' : 'status_blocked';
_user_mail_notify($op, $user);
}
user_module_invoke('after_update', $array, $user, $category);
}
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment