Forum Discussion
AndrewRost
13 years agoCommunity Member
Retrieve LMS User Name as Variable
I know you can have a user fill in a text box with their name and then later use that variable for personalization. What we would like to do is programmatically retrieve the user name from the LMS....
BrettRockwood
13 years agoCommunity Member
Can I revisit this topic again? Using Phil's JavaScript I can get the student's full name from the LMS no problem. But I'd like to just get the first name to put a little personalization into the training, e.g. "Hi Erika, welcome to today's session...". How would I need to modify the script to pull just the first name?
Here is the full name script:
var player = GetPlayer();
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);
//myName = player.GetVar('myName');
//player.SetVar("newName", newName);
Thanks as always.