include "header.php"; $task = isset($_POST['task']) && $_POST['task'] ? trim($_POST['task']) : ''; $task = !$task && (isset($_GET['task']) && $_GET['task']) ? $_GET['task'] : $task; $current_page = isset($_GET['page']) && $_GET['page'] ? (int) $_GET['page'] : 1; $quiz_id = isset($_GET['quiz_id']) && $_GET['quiz_id'] ? (int) $_GET['quiz_id'] : 0; // DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION if (!$user->user_exists) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 656); $smarty->assign('error_submit', 641); include "footer.php"; } $message = array(); if ($task == 'delete') { he_quiz::delete_quiz($quiz_id); header("Location: user_quiz.php"); exit; } elseif ($task == 'publish' || $task == 'unpublish') { $status = $task == 'publish' ? 1 : 0; he_quiz::publish_quiz($quiz_id, $status); header("Location: user_quiz.php?page=" . $current_page); exit; } //TODO get from configs $on_page = 10; $pages = 5; $first = ($current_page - 1) * $on_page; $quiz_arr = he_quiz::user_quiz_list($user->user_info['user_id'], $first, $on_page); $quiz_total = he_quiz::user_quiz_total($user->user_info['user_id']); $smarty->assign('current_page', $current_page);
function delete_user_info($user_id) { //get user quizzes $query = he_database::placeholder("SELECT `id` FROM `se_he_quiz`\r\n WHERE `user_id`=?", $user_id); $quiz_ids = he_database::fetch_column($query); foreach ($quiz_ids as $quiz_id) { he_quiz::delete_quiz($quiz_id); } //delete user plays $query = he_database::placeholder("DELETE FROM `se_he_quiz_play`\r\n WHERE `user_id`=?", $user_id); he_database::query($query); }