Forum Discussion
Retrieve LMS User Name as Variable
Newbie here - Is there a way for the variable to retrieve the user name without the user having to click a button?
Hey Jennifer!
You set up a variable called *newName* (you could call it anything you
want, just make sure the javascript I am about to share with you has the
same variable mentioned)
And then you set up a trigger to run at the start of the timeline, to
execute javascript.
And in the pace where the javascript is meant to go, you enter this:
var player = GetPlayer();
var myName = lmsAPI.GetStudentName();
var arrayName = myName.split(' ');
var newName = arrayName[0];
player.SetVar("newName", newName);
This works for my LMS. I'm no expert, but you can try this and ask around
if this doesn't work. There are versions of this floating around.