diff options
Diffstat (limited to 'actions/profilesettings.php')
-rw-r--r-- | actions/profilesettings.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/actions/profilesettings.php b/actions/profilesettings.php index b703c8b2b..04526a212 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -52,8 +52,6 @@ class ProfilesettingsAction extends SettingsAction { common_input('location', _('Location'), ($this->arg('location')) ? $this->arg('location') : $profile->location, _('Where you are, like "City, State (or Region), Country"')); - common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'), - ($this->arg('autosubscribe')) ? $this->boolean('autosubscribe') : $user->autosubscribe); common_submit('submit', _('Save')); common_element_end('form'); common_show_footer(); @@ -66,8 +64,7 @@ class ProfilesettingsAction extends SettingsAction { $homepage = $this->trimmed('homepage'); $bio = $this->trimmed('bio'); $location = $this->trimmed('location'); - $autosubscribe = $this->boolean('autosubscribe'); - + # Some validation if (!Validate::string($nickname, array('min_length' => 1, @@ -94,6 +91,8 @@ class ProfilesettingsAction extends SettingsAction { } else if ($this->nickname_exists($nickname)) { $this->show_form(_('Nickname already in use. Try another one.')); return; + } else if (!is_null($language) && strlen($language) > 50) { + $this->show_form(_('Language is too long (max 50 chars).')); } $user = common_current_user(); @@ -117,6 +116,23 @@ class ProfilesettingsAction extends SettingsAction { return; } } + if ($user->language != $language) { + + common_debug('Updating user language from ' . $user->language . ' to ' . $language, + __FILE__); + + $original = clone($user); + + $user->language = $language; + + $result = $user->updateKeys($original); + + if ($result === FALSE) { + common_log_db_error($user, 'UPDATE', __FILE__); + common_server_error(_('Couldn\'t update user.')); + return; + } + } # XXX: XOR |