本文整理汇总了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.');
}