- $nickname = $this->trimmed('newnickname');
- try {
- $nickname = Nickname::normalize($nickname, true);
- } catch (NicknameTakenException $e) {
- // Abort only if the nickname is occupied by _another_ group
- if ($e->profile->id != $this->group->profile_id) {
+ // $nickname will only be set if this changenick value is true.
+ if (common_config('profile', 'changenick') == true) {
+ try {
+ $nickname = Nickname::normalize($this->trimmed('newnickname'), true);
+ } catch (NicknameTakenException $e) {
+ // Abort only if the nickname is occupied by _another_ group
+ if ($e->profile->id != $this->group->profile_id) {
+ $this->showForm($e->getMessage());
+ return;
+ }
+ $nickname = Nickname::normalize($this->trimmed('newnickname')); // without in-use check this time
+ } catch (NicknameException $e) {