I am working in a wordpress environment (Learndash) and would like to get the userid etc from wordpress to include in an articulate file. So, ideally, I would like to get JS to get the information (unless there is a simpler way). Does anyone know how to do that?
Hi Andrew, when you say userid etc, what information do you want to get? It would be possible to get this information from wordpress/learndash if that information is available as a JS variable or via and API within wordpress.
I am looking for a way to get the information from wp_get_current_user into a JS variable that I can then process to personalize my Articulate lesson (e.g. show full name - or even user id or whatever). I know how to do that in PHP but articulate requires JS.
I forgot to add that I don't see how to get the information out of WP directly through JS. I confess I do not know WP very well and have not followed up on its API.
Hi Andrew, yes you would need to have some understanding of WordPress in order to make this possible. There is a method for making JavaScript variables available to applications via the functions.php file of your project.
Maybe Learndash provides this information through an API though? It might be worth first contacting LearnDash and asking "Do you provide a JavaScript API to get any user information such as ID". If they do, then the method to access this and load into your course will be relatively simple.
The WordPress method is a bit more involved, and you'd definitely need somebody who is comfortable working with the functions.php file in WordPress in order to get that data for you.
4 Replies
Hi Andrew, when you say userid etc, what information do you want to get? It would be possible to get this information from wordpress/learndash if that information is available as a JS variable or via and API within wordpress.
Hi Sam and thanks for the information/question.
I am looking for a way to get the information from wp_get_current_user into a JS variable that I can then process to personalize my Articulate lesson (e.g. show full name - or even user id or whatever). I know how to do that in PHP but articulate requires JS.
I forgot to add that I don't see how to get the information out of WP directly through JS. I confess I do not know WP very well and have not followed up on its API.
Hi Andrew, yes you would need to have some understanding of WordPress in order to make this possible. There is a method for making JavaScript variables available to applications via the functions.php file of your project.
Maybe Learndash provides this information through an API though? It might be worth first contacting LearnDash and asking "Do you provide a JavaScript API to get any user information such as ID". If they do, then the method to access this and load into your course will be relatively simple.
The WordPress method is a bit more involved, and you'd definitely need somebody who is comfortable working with the functions.php file in WordPress in order to get that data for you.
This discussion is closed. You can start a new discussion or contact Articulate Support.