User : Fix anonymous access to exercise when using direct link to exercice and not passing through main course page - refs BT#20245

pull/4430/head
Nicolas Ducoulombier 3 years ago
parent 08afb73081
commit fe6a2d0805
  1. 1
      main/exercise/overview.php
  2. 3
      main/inc/lib/api.lib.php

@ -7,6 +7,7 @@
*
* @author Julio Montoya <gugli100@gmail.com>
*/
$use_anonymous = true;
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_QUIZ;
Exercise::cleanSessionVariables();

@ -3930,6 +3930,9 @@ function api_is_anonymous($user_id = null, $db_check = false)
//if ($_user['user_id'] == 0) {
// In some cases, api_set_anonymous doesn't seem to be triggered in local.inc.php. Make sure it is.
// Occurs in agenda for admin links - YW
// it occurs when pages are opened directly without entering first the course home page. To fix it add
// $use_anonymous = true;
// before including global.inc.php in the page
global $use_anonymous;
if (isset($use_anonymous) && $use_anonymous) {
api_set_anonymous();

Loading…
Cancel
Save