diff --git a/h5p/classes/helper.php b/h5p/classes/helper.php index dd12ca617613d..b561b5e2ca379 100644 --- a/h5p/classes/helper.php +++ b/h5p/classes/helper.php @@ -312,6 +312,8 @@ public static function get_core_settings(): array { $factory = new factory(); $core = $factory->get_core(); + // When there is a logged in user, her information will be passed to the player. It will be used for tracking. + $usersettings = isloggedin() ? ['name' => $USER->username, 'mail' => $USER->email] : []; $settings = array( 'baseUrl' => $basepath, 'url' => "{$basepath}pluginfile.php/{$systemcontext->instanceid}/core_h5p", @@ -321,7 +323,7 @@ public static function get_core_settings(): array { 'saveFreq' => false, 'siteUrl' => $CFG->wwwroot, 'l10n' => array('H5P' => $core->getLocalization()), - 'user' => ['name' => $USER->username, 'mail' => $USER->email], + 'user' => $usersettings, 'hubIsEnabled' => true, 'reportingIsEnabled' => false, 'crossorigin' => null,