Skip to content

Commit

Permalink
MDL-67788 h5p: fix issue for non logged-in users
Browse files Browse the repository at this point in the history
  • Loading branch information
sarjona authored and stronk7 committed Apr 16, 2020
1 parent 2ac1d9a commit 0a05ca3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion h5p/classes/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down

0 comments on commit 0a05ca3

Please sign in to comment.