static function can_access($exam) { // always access public exams if (!$exam->require_login) { return true; } if ($exam->require_login and !is_user_logged_in()) { return false; } // admin can always access if (current_user_can('manage_options') or current_user_can('watupro_manage_exams')) { if (empty($_POST['action']) and $exam->fee > 0) { echo "<b>" . __('Note: This quiz requires payment, but you are administrator and do not need to go through it.', 'watupro') . "</b>"; } return true; } // USER GROUP CHECKS $allowed = WTPCategory::has_access($exam); if (!$allowed) { echo "<!-- not in allowed user group -->"; return false; } // INTELLIGENCE MODULE RESTRICTIONS if (watupro_intel()) { if ($exam->fee > 0) { require_once WATUPRO_PATH . "/i/models/payment.php"; if (!empty($_POST['stripe_pay'])) { WatuPROPayment::Stripe(); } // process Stripe payment if any if (!WatuPROPayment::valid_payment($exam)) { self::$output_sent = WatuPROPayment::render($exam); return false; } } require_once WATUPRO_PATH . "/i/models/dependency.php"; if (!WatuPRODependency::check($exam)) { echo "<!-- WATUPROCOMMENT unsatisfied dependencies -->"; return false; } } return true; }