Forum Discussion

ChrisPim-f7a22b's avatar
ChrisPim-f7a22b
Community Member
3 years ago

Moodle issue reporting the student name

Hi,
 
We have some courses created in Storyline 360, exported as SCORM packages and hosted in Moodle
 
We use the Javascript code below which ran on enter slide and always worked just fine..
 
Now, instead of the variable 'newName' referenced in a text field reporting 'Chris Pim" as it should, it reports "undefined Chris Pim"
 
I suspect a Moodle update has caused this bug but have no idea how to remedy it - can anyone help?
 
---------------------------------
 
var player = GetPlayer();
 
 
function findLMSAPI(win) {
// look in this window
  if (win.hasOwnProperty("GetStudentID")) return win;
 
// all done if no parent
  else if (win.parent == win) return null;
 
// climb up to parent window & look there
  else return findLMSAPI(win.parent);
}
 
 
var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.GetStudentName();
var array  = myName.split(',');
var newName = array[1] + '  ' + array[0];
player.SetVar("newName", newName);