15 Replies
PRAKASH B

Hi Guys,

I found this solution from the below code.

function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var a =[];var a1 = [];
var foo = getParameterByName('actor');
a = foo.split(",");
var x=a[0];
a1 = x.split("[");
var str = a1[1];
var UName = str.replace(/[^a-zA-Z ]/g, "");
var player = GetPlayer();
player.SetVar("UserName",UName);
Steve Flowers

Hi, Stephanie - The agent string is the identifier. The concept of student ID doesn't exist in the LRS. All queries and submission are tied to the actor defined in the statement. This is the value passed into the xapi publish from the content launch and extracted from the URL string in the code above.

"actor": {
"mbox": "mailto:user.name@org.com",
"name": "Name, User",
"objectType": "Agent"
},

Steve Flowers

SCORM won't expose that. However, you can construct that MBOX for a unique identifier.

last.first@org-name.org

It comes across as an email but the function of an actor identifier is a unique id for each participant. As long as you're consistent, reports should return consistently:)

 

 

Stephanie Harnett

Thanks Steve, the client is using Tin Can and I'm publishing that way. The JS code in SL below works work well to pull the student name into a variable but I'd also like to pull in the student email which is the mbox content in the LMS (Absorb). The Absorb people looked at this code and said I needed to change 'actor' to 'name' and to grab email, change 'actor' to 'mbox' - which didn't work. Any help would be really good.  : )

function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

var a =[];var a1 = [];
var foo = getParameterByName('actor');
a = foo.split(",");
var x=a[0];
a1 = x.split("[");
var str = a1[1];
var UName = str.replace(/[^a-zA-Z ]/g, "");
var player = GetPlayer();
player.SetVar("UserName",UName);