* @return boolean success flag
*
*/
- protected function prepare($args)
+ protected function prepare(array $args=array())
{
parent::prepare($args);
- $this->nickname = common_canonical_nickname($this->trimmed('nickname'));
+ $this->nickname = Nickname::normalize($this->trimmed('nickname'));
$this->fullname = $this->trimmed('fullname');
$this->homepage = $this->trimmed('homepage');
try {
- if (!empty($this->nickname)) {
+ if (common_config('profile', 'changenick') == true && $this->group->nickname !== $this->nickname) {
try {
$this->group->nickname = Nickname::normalize($this->nickname, true);
- } catch (NicknameTakenException $e) {
- // Abort only if the nickname is occupied by _another_ local group
- if ($e->profile->id != $this->group->id) {
- throw new ApiValidationException($e->getMessage());
- }
} catch (NicknameException $e) {
throw new ApiValidationException($e->getMessage());
}
$this->serverError(_('Could not create aliases.'));
}
- if (!empty($this->nickname) && ($this->nickname != $orig->nickname)) {
- common_log(LOG_INFO, "Saving local group info.");
- $local = Local_group::getKV('group_id', $this->group->id);
- $local->setNickname($this->nickname);
- }
-
$this->group->query('COMMIT');
switch($this->format) {