function delete($useWhere = false) { $this->_deleteNotices(); $this->_deleteSubscriptions(); $this->_deleteTags(); $this->_deleteBlocks(); $this->_deleteAttentions(); Avatar::deleteFromProfile($this, true); // Warning: delete() will run on the batch objects, // not on individual objects. $related = array('Reply', 'Group_member'); Event::handle('ProfileDeleteRelated', array($this, &$related)); foreach ($related as $cls) { $inst = new $cls(); $inst->profile_id = $this->id; $inst->delete(); } $localuser = User::getKV('id', $this->id); if ($localuser instanceof User) { $localuser->delete(); } return parent::delete($useWhere); }
protected function newAvatar(Profile $profile, $url, $filename, $mediatype) { // Clear out old avatars, won't do anything if there are none Avatar::deleteFromProfile($profile); // throws exception if unable to fetch $this->fetchRemoteUrl($url, Avatar::path($filename)); $avatar = new Avatar(); $avatar->profile_id = $profile->id; $avatar->original = 1; // this is an original/"uploaded" avatar $avatar->mediatype = $mediatype; $avatar->filename = $filename; $avatar->width = $this->avatarsize; $avatar->height = $this->avatarsize; $avatar->created = common_sql_now(); $id = $avatar->insert(); if (empty($id)) { common_log(LOG_WARNING, __METHOD__ . " Couldn't insert avatar - " . $e->getMessage()); common_log_db_error($avatar, 'INSERT', __FILE__); throw new ServerException('Could not insert avatar'); } common_debug(__METHOD__ . " - Saved new avatar for {$profile->id}."); return $avatar; }
/** * Get rid of the current avatar. * * @return void */ function deleteAvatar() { $user = common_current_user(); $profile = $user->getProfile(); Avatar::deleteFromProfile($profile); // TRANS: Success message for deleting a user avatar. $this->showForm(_('Avatar deleted.'), true); }
function delete($useWhere = false) { // just in case it hadn't been done before... (usually set before adding deluser to queue handling!) if (!$this->hasRole(Profile_role::DELETED)) { $this->grantRole(Profile_role::DELETED); } $this->_deleteNotices(); $this->_deleteSubscriptions(); $this->_deleteTags(); $this->_deleteBlocks(); $this->_deleteAttentions(); Avatar::deleteFromProfile($this, true); // Warning: delete() will run on the batch objects, // not on individual objects. $related = array('Reply', 'Group_member'); Event::handle('ProfileDeleteRelated', array($this, &$related)); foreach ($related as $cls) { $inst = new $cls(); $inst->profile_id = $this->id; $inst->delete(); } $localuser = User::getKV('id', $this->id); if ($localuser instanceof User) { $localuser->delete(); } return parent::delete($useWhere); }
/** * Get rid of the current avatar. * * @return void */ function deleteAvatar() { Avatar::deleteFromProfile($this->scoped); // TRANS: Success message for deleting a user avatar. return _('Avatar deleted.'); }