MDL-67788 h5p: fix issue for non logged-in users

This commit is contained in:
Sara Arjona 2020-04-16 14:09:25 +02:00 committed by Eloy Lafuente (stronk7)
parent 2ac1d9aedf
commit 0a05ca3604

View File

@ -312,6 +312,8 @@ class helper {
$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 @@ class helper {
'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,