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....
MichaelLaudone
10 years agoCommunity Member
I never saw a solution to the middle inital issue: Here's what I did:
<script type="text/javascript" language="JavaScript">
function getName(){
var sName = lmsAPI.LMSGetValue("cmi.core.student_name");
sName = sName.replace(',','');
var aSplit = sName.split(" ");
player.SetVar("v_LastName", aSplit[0]);
player.SetVar("v_FirstName", aSplit[1]);
player.SetVar("v_MiddleInitial", aSplit[2]);
}
</script>