/** * Delete Profile Avatar * * @param void * @return null */ function delete_avatar() { if ($this->active_user->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_user->canEdit($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->request->isSubmitted()) { unlink($this->active_user->getAvatarPath()); unlink($this->active_user->getAvatarPath(true)); if ($this->request->isAsyncCall()) { $this->serveData(array('message' => lang('Icon successfully removed'), 'icon' => $this->active_user->getAvatarUrl(true)), 'delete', null, FORMAT_JSON); } else { $this->redirectToUrl($this->active_user->getEditAvatarUrl()); } } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if }