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....
SteveFlowers
Community Member
Ah. The very first one posted was Flash only. However, HTML5 output supports the second one posted no problem. Has for awhile:)
Only works in Flash:
player.SetVar("sLearnerName", SCORM_GetStudentName());
Works in all:
var player = GetPlayer();
//might need to use lmsAPI=parent; on some LMS
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);
AlexYong1
10 years agoCommunity Member
Gah! Ok, but the issue that Tanmay found was that this JS wouldn't work on the certificate or results slide. But now that i'm comparing the code I see he's using something different. The code you posted above will work in the results slide too? Or is that the limitation that Tanmay was working around?
Thanks in advanced for helping me understand, this is so very helpful!