public function deleteUsers($userids) { $status = array(); foreach ($userids as $userid) { $m_userid = intval($userid); if ($m_userid == 0) { continue; } $status[$m_userid] = self::_deleteUser($m_userid); } if (!del_user_dir($userids)) { trigger_error(__CLASS__ . '::' . __METHOD__ . ' - User files/data was not found?', E_USER_NOTICE); return false; } return $status; }
/** * Delete record by ID * This method will delete record from database * * @param integer $id ID of the record to be deleted * @param boolean $deleteAllOwnedData Whether or not to delete all data associated with this user * * @return boolean Returns TRUE if successful, FALSE otherwise */ public function deleteRecordByID($id, $deleteAllOwnedData = true) { if ($deleteAllOwnedData) { $obj = new HelperUserDelete(); $status = $obj->deleteUsers(array($id)); if ($status[$id]['status'] === false) { return false; } else { return true; } } $userid = intval($id); $db = IEM::getDatabase(); $db->StartTransaction(); $query = "DELETE FROM [|PREFIX|]users WHERE userid = {$userid}"; $result = $db->Query($query); if (!$result) { $db->RollbackTransaction(); trigger_error(__CLASS__ . '::' . __METHOD__ . ' - Unable to delete user record' . $db->Error(), E_USER_NOTICE); return false; } if (!del_user_dir($userid)) { $db->RollbackTransaction(); trigger_error(__CLASS__ . '::' . __METHOD__ . ' - User files/data was not found?', E_USER_NOTICE); return false; } $db->CommitTransaction(); return true; }