Grabbing The User Name Of The Current User From WordPress
Here are the steps to perform in order to make this work inside of your own Articulate Storyline projects published to your WordPress site:
Start by ensuring the plugin is activated and registered, as well as making sure you are running the latest version of LearnDash LMS.
var player = GetPlayer(); var firstname = window.parent.slfirstname; var lastname = window.parent.sllastname; player.SetVar("firstnamevariableinproject", firstname); player.SetVar("lastnamevariableinproject", lastname);
It is recommended that you include some validation triggers within your project. By default, if no first name or last name is detected for the user, or if the user is a signed out and is viewing the course page as a guest, then by default the JS variables for ‘firstname’ and ‘lastname’ will default to ‘Guest’.
Using this you can, for example, create a trigger which will prompt the learner to manually input their name if the ‘firstname’ of Guest is detected when the slide first loads.
Publish the project to your LearnDash lesson or topic page either within an iframe or a lightbox window.
If you need further information on best practice for embedding Storyline content onto a web page, use this Articulate Storyline help guide.
Read the rest of our Knowledge Base pages to make the most of the eLearning Magic Toolkit.