$course_id = '';
$unit_id = '';
if (isset($_GET['course_id']) && is_numeric($_GET['course_id'])) {
    $course_id = (int) $_GET['course_id'];
    $course = new Course($course_id);
}
if (!empty($course_id) && !CoursePress_Capabilities::can_view_course_units($_GET['course_id'])) {
    die(__('You do not have required permissions to access this page.', 'cp'));
}
if (!isset($_POST['force_current_unit_completion'])) {
    $_POST['force_current_unit_completion'] = 'off';
}
if (!isset($_POST['force_current_unit_successful_completion'])) {
    $_POST['force_current_unit_successful_completion'] = 'off';
}
Unit_Module::check_for_modules_to_delete();
if (isset($_GET['unit_id'])) {
    $unit_id = (int) $_GET['unit_id'];
    $unit = new Unit($unit_id);
    $unit_details = $unit->get_unit();
    $force_current_unit_completion = $unit->details->force_current_unit_completion;
    $force_current_unit_successful_completion = $unit->details->force_current_unit_successful_completion;
    $unit_pagination = cp_unit_uses_new_pagination((int) $_GET['unit_id']);
} else {
    $unit = new Unit();
    $unit_id = 0;
    $force_current_unit_completion = 'off';
    $force_current_unit_successful_completion = 'off';
    $unit_pagination = false;
}
if ($unit_id == 0) {