How to get student name and id from WordPress learndash LMS

Hello all,

Can anyone help me on how to retrieve the student name and mail id from Wordpress Learndash LMS.

I have gone through various thread and nothing works.

Please check the below code.

var player = GetPlayer();
function findLMSAPI(win)

if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var mailid = lmsAPI.GetStudentID();
var name = lmsAPI.GetStudentName();
var nameArray = name.split(",");
var firstName = nameArray[1];
var lastName = nameArray[0];
var player = GetPlayer();
player.SetVar('fname1',firstName);
player.SetVar('lname1',lastName);
player.SetVar('mail1',mailid);
alert(firstName,"FN");
alert(lastName,"LN");
alert(mailid,"email");


1 Reply