diff --git a/htdocs/js/loris.js b/htdocs/js/loris.js
index b0ddcf438b2..c88c576f5b9 100644
--- a/htdocs/js/loris.js
+++ b/htdocs/js/loris.js
@@ -1,6 +1,6 @@
/* exported LorisHelper */
-let LorisHelper = function(configParams, userPerms, studyParams) {
+let LorisHelper = function(user, configParams, userPerms, studyParams) {
'use strict';
let lorisObj = configParams;
@@ -72,6 +72,8 @@ let LorisHelper = function(configParams, userPerms, studyParams) {
'use strict';
return studyParams[param];
};
+
+ lorisObj.user = user;
return lorisObj;
};
diff --git a/smarty/templates/main.tpl b/smarty/templates/main.tpl
index 7ad1025227b..323deca0e32 100644
--- a/smarty/templates/main.tpl
+++ b/smarty/templates/main.tpl
@@ -13,7 +13,7 @@
and can access them through the loris global (ie. loris.BaseURL) *}
{section name=jsfile loop=$jsfiles}
diff --git a/src/Middleware/UserPageDecorationMiddleware.php b/src/Middleware/UserPageDecorationMiddleware.php
index 09fc7a1cf43..8c5bc890c39 100644
--- a/src/Middleware/UserPageDecorationMiddleware.php
+++ b/src/Middleware/UserPageDecorationMiddleware.php
@@ -221,6 +221,10 @@ function ($a, $b) {
// Do not show menu item if module not active
$tpl_data['my_preferences'] = $loris->hasModule('my_preferences');
+ $tpl_data['userjson'] = json_encode([
+ 'username' => $user->getUsername(),
+ 'id' => $user->getId()
+ ]);
// Display the footer links, as specified in the config file
$links = $this->Config->getExternalLinks('FooterLink');