Parse $USER-object variables in additionalhtml

Parse $USER-object variables in additionalhtml

by Siska Meijer -
Number of replies: 0
Hi,


I'm trying to add a javascript to every page of Moodle (version 3.3.2), I've found the additionalhtml in the settings ([DOMAIN]/admin/settings.php?section=additionalhtml).

This works just fine but I also want to pass the username or userid in the javascript.

In languagestring you can parse PHP-variables like this:
Some text blablabla {$a->username} end of the line.

I tried doing something similar in the additionalhtmltopofbody field, to test it I've put:
Who am I? {$USER->username}

That did not give me the username (when loggedin), it gives exactly what I put in, so I also tried:
{$user->username}
{$a->username}
{$username}

Is this something I can do, do I need to use an other type of parsing or isn't this possible at all?

Thanks in advance!
Average of ratings: -