$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",
'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,