本文整理匯總了PHP中Avatar::deleteFromProfile方法的典型用法代碼示例。如果您正苦於以下問題:PHP Avatar::deleteFromProfile方法的具體用法?PHP Avatar::deleteFromProfile怎麽用?PHP Avatar::deleteFromProfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Avatar
的用法示例。
在下文中一共展示了Avatar::deleteFromProfile方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: delete
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);
}
示例2: newAvatar
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;
}
示例3: deleteAvatar
/**
* 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);
}
示例4: delete
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);
}
示例5: deleteAvatar
/**
* 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.');
}