Forum Discussion
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. Is there a way to set a variable with data from the LMS when the course is loaded instead of having the user enter their name?
Thx
- MirandaVerswijvCommunity Member
We are successfully using it in a privacy course, where we pull the learner's name through to feature in privacy breach scenarios. It has a great sensitising effect on them!
Bid problem though: This works brilliantly for us in Firefox and Chrome, but fails completely in IE.
Any thoughts?
- SteveFlowersCommunity Member
Hi Miranda -
What version of IE?
- MirandaVerswijvCommunity Member
Hi Steve,
We have encountered it on IE 10 and 11. We are using Totara LMS (the commercial version of Moodle)
- HelenaSmithCommunity Member
We have an outside source that sends emails to the users such as: New User templates, change password/reset
The variable set up for user name is %%susername%%
What type of coding is this?
If I want to set up a text box with the user typing in their names, will i need to use this type of coding??
Hi Helena,
In Storyline you use the % % signs around the name of a variable to reference whatever is being held within that variable (be it text, numeric value, a t/f). This is described here.
If you're looking to pull in code from your LMS, you'll need to look at using some Javascript, which I'll have to defer to the community for.
- HelenaSmithCommunity Member
Ok thank you. Let me take a look.
- HelenaSmithCommunity Member
So the %% signs around the variable make the information unique, as oppose to a single % surrounding the variable?
I haven't seen the double % signs, and that's not a built in feature of Storyline. Are you seeing that in a .story file that you set up or that someone else shared with you? Anymore information you could share would be helpful in terms of identifying that.
- HelenaSmithCommunity Member
In Storyline I have seen the %name% for example but we are using a third party server with our emails and LMS and for usernames they use %%ABC_username%%
I was trying to figure out the difference between one percent sign and two.
Is this Javascript?
Hi Helena,
I would say not - the Javascript that would be used in Storyline is as shown here. You'd likely need to be using Javascript to pull information from the LMS into your Storyline course such as name - and if you need to report to your LMS on variables within Storyline you'll want to use the method here.
- JayDharapCommunity Member
Hey guys! this is almsot exactly what I was looking for...Just that i want to use the first name, not the full name. I tried using just the Array[1] and removing everything else from the JS script but it doesnt work. Suggestions?