/** * deletes a user * @access public * @param integer user_id */ function delete() { global $rbacadmin, $ilDB; // deassign from ldap groups include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php'; $mapping = ilLDAPRoleGroupMapping::_getInstance(); $mapping->deleteUser($this->getId()); // remove mailbox / update sent mails include_once "Services/Mail/classes/class.ilMailbox.php"; $mailbox = new ilMailbox($this->getId()); $mailbox->delete(); $mailbox->updateMailsOfDeletedUser($this->getLogin()); // delete feed blocks on personal desktop include_once "./Services/Block/classes/class.ilCustomBlock.php"; $costum_block = new ilCustomBlock(); $costum_block->setContextObjId($this->getId()); $costum_block->setContextObjType("user"); $c_blocks = $costum_block->queryBlocksForContext(); include_once "./Services/Feeds/classes/class.ilPDExternalFeedBlock.php"; foreach ($c_blocks as $c_block) { if ($c_block["type"] == "pdfeed") { $fb = new ilPDExternalFeedBlock($c_block["id"]); $fb->delete(); } } // delete block settings include_once "./Services/Block/classes/class.ilBlockSetting.php"; ilBlockSetting::_deleteSettingsOfUser($this->getId()); // delete user_account $ilDB->manipulateF("DELETE FROM usr_data WHERE usr_id = %s", array("integer"), array($this->getId())); // delete user_prefs ilObjUser::_deleteAllPref($this->getId()); // delete user_session include_once "./Services/Authentication/classes/class.ilSession.php"; ilSession::_destroyByUserId($this->getId()); // remove user from rbac $rbacadmin->removeUser($this->getId()); // remove bookmarks // TODO: move this to class.ilBookmarkFolder $q = "DELETE FROM bookmark_tree WHERE tree = " . $ilDB->quote($this->getId(), "integer"); $ilDB->manipulate($q); $q = "DELETE FROM bookmark_data WHERE user_id = " . $ilDB->quote($this->getId(), "integer"); $ilDB->manipulate($q); // DELETE FORUM ENTRIES (not complete in the moment) include_once './Modules/Forum/classes/class.ilObjForum.php'; ilObjForum::_deleteUser($this->getId()); // Delete link check notify entries include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php'; ilLinkCheckNotify::_deleteUser($this->getId()); // Delete crs entries include_once './Modules/Course/classes/class.ilObjCourse.php'; ilObjCourse::_deleteUser($this->getId()); // Delete user tracking include_once './Services/Tracking/classes/class.ilObjUserTracking.php'; ilObjUserTracking::_deleteUser($this->getId()); include_once 'Modules/Session/classes/class.ilEventParticipants.php'; ilEventParticipants::_deleteByUser($this->getId()); // Delete Tracking data SCORM 2004 RTE include_once 'Modules/Scorm2004/classes/ilSCORM13Package.php'; ilSCORM13Package::_removeTrackingDataForUser($this->getId()); // Delete Tracking data SCORM 1.2 RTE include_once 'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php'; ilObjSCORMLearningModule::_removeTrackingDataForUser($this->getId()); // remove all notifications include_once "./Services/Notification/classes/class.ilNotification.php"; ilNotification::removeForUser($this->getId()); // remove portfolios include_once "./Modules/Portfolio/classes/class.ilObjPortfolio.php"; ilObjPortfolio::deleteUserPortfolios($this->getId()); // remove workspace include_once "./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $tree = new ilWorkspaceTree($this->getId()); $tree->cascadingDelete(); // remove disk quota entries include_once "./Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; ilDiskQuotaHandler::deleteByOwner($this->getId()); // Delete user defined field entries $this->deleteUserDefinedFieldEntries(); // Delete clipboard entries $this->clipboardDeleteAll(); // Reset owner $this->resetOwner(); // Trigger deleteUser Event global $ilAppEventHandler; $ilAppEventHandler->raise('Services/User', 'deleteUser', array('usr_id' => $this->getId())); // delete object data parent::delete(); return true; }