- if ($user->nickname != $nickname ||
- $user->language != $language ||
- $user->timezone != $timezone) {
-
- common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname,
- __FILE__);
- common_debug('Updating user language from ' . $user->language . ' to ' . $language,
- __FILE__);
- common_debug('Updating user timezone from ' . $user->timezone . ' to ' . $timezone,
- __FILE__);
-
- $original = clone($user);
-
- $user->nickname = $nickname;
- $user->language = $language;
- $user->timezone = $timezone;
-
- $result = $user->updateKeys($original);
-
- if ($result === false) {
- common_log_db_error($user, 'UPDATE', __FILE__);
- // TRANS: Server error thrown when user profile settings could not be updated.
- $this->serverError(_('Could not update user.'));
- return;
- } else {
- // Re-initialize language environment if it changed
- common_init_language();
- // Clear the site owner, in case nickname changed
- if ($user->hasRole(Profile_role::OWNER)) {
- User::blow('user:site_owner');
- }
- }
- }