- # Keys don't update correctly, so we have to handle them separately
-
- if (strcmp($user->nickname, $nickname) != 0) {
-
- common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname,
- __FILE__);
-
- $original = clone($user);
-
- $user->nickname = $nickname;
-
- $result = $user->updateKeys($original);
-
- if ($result === FALSE) {
- common_log_db_error($user, 'UPDATE', __FILE__);
- common_server_error(_t('Couldnt update user.'));
- return;
- }
- }
-
- if (strcmp($user->email, $email) != 0) {
-
- common_debug('Updating user email from ' . $user->email . ' to ' . $email,
- __FILE__);
-
- # We don't update email directly; it gets done by confirmemail
-
- $confirm = new Confirm_address();
-
- $confirm->code = common_confirmation_code(128);
- $confirm->user_id = $user->id;
- $confirm->address = $email;
- $confirm->address_type = 'email';
-
- $result = $confirm->insert();
-
- if (!$result) {
- common_log_db_error($confirm, 'INSERT', __FILE__);
- common_server_error(_t('Couldnt confirm email.'));
- return FALSE;
- }
-
- # XXX: try not to do this in the middle of a transaction
-
- mail_confirm_address($confirm->code,
- $profile->nickname,
- $email);
- }
-