/** * Remove an address * * If the user has a confirmed address, remove it. * * @return void */ function removeAddress() { $screenname = $this->trimmed('screenname'); $transport = $this->trimmed('transport'); // Maybe an old tab open...? $user_im_prefs = new User_im_prefs(); $user_im_prefs->user_id = $this->scoped->getID(); $user_im_prefs->transport = $transport; if (!$user_im_prefs->find(true)) { // TRANS: Message given trying to remove an IM address that is not // TRANS: registered for the active user. throw new AlreadyFulfilledException(_('There were no preferences stored for this transport.')); } $result = $user_im_prefs->delete(); if ($result === false) { common_log_db_error($user_im_prefs, 'UPDATE', __FILE__); // TRANS: Server error thrown on database error removing a registered IM address. throw new ServerException(_('Could not update user IM preferences.')); } // XXX: unsubscribe to the old address // TRANS: Message given after successfully removing a registered Instant Messaging address. return _('The IM address was removed.'); }
/** * Remove an address * * If the user has a confirmed address, remove it. * * @return void */ function removeAddress() { $user = common_current_user(); $screenname = $this->trimmed('screenname'); $transport = $this->trimmed('transport'); // Maybe an old tab open...? $user_im_prefs = new User_im_prefs(); $user_im_prefs->user_id = $user->id; if (!($user_im_prefs->find() && $user_im_prefs->fetch())) { // TRANS: Message given trying to remove an IM address that is not // TRANS: registered for the active user. $this->showForm(_('That is not your screenname.')); return; } $result = $user_im_prefs->delete(); if (!$result) { common_log_db_error($user, 'UPDATE', __FILE__); // TRANS: Server error thrown on database error removing a registered IM address. $this->serverError(_('Could not update user IM preferences.')); return; } // XXX: unsubscribe to the old address // TRANS: Message given after successfully removing a registered Instant Messaging address. $this->showForm(_('The IM address was removed.'), true); }