static function check_access($exam, $post) { WatuPRO::$output_sent = false; // change this var from class method to avoid outputting the generic message if (!WatuPRO::can_access($exam)) { // not logged in error if (!is_user_logged_in()) { echo "<p><b>" . sprintf(__('You need to be registered and logged in to take this %s.', 'watupro'), __('quiz', 'watupro')) . " <a href='" . wp_login_url(get_permalink($post->ID)) . "'>" . __('Log in', 'watupro') . "</a>"; if (get_option("users_can_register")) { echo " " . __('or', 'watupro') . " <a href='" . wp_registration_url() . "'>" . __('Register', 'watupro') . "</a></b>"; } echo "</p>"; } else { // logged in but no rights to access if (!WatuPRO::$output_sent) { echo "<p>" . __('You are not allowed to access this exam at the moment.', 'watupro') . "</p><!-- logged in but no rights to access-->"; } } return false; // can_access returned false } return true; }