Ajax action ” Finish Course”
-
AuthorPosts
-
-
February 9, 2018 at 9:35 PM #261629adislicParticipant
When the user completes a course, need to send API call to an external platform. Already inserted API call that passes email address of the user and everything is working fine. Right now I am using hardcoded email for testing but need to get current user email and insert it as a variable. Because of Ajax call, I am not able to figure out how to get the email of that user using standard WordPress function for user data. Does Learnpress already have some function to get user email inside js file?
single-course.js
finishCourse: function (args) { var that = this; LP.ajax({ url : this.get(‘url’), action : ‘finish-course’, data : args.data, dataType : ‘json’, beforeSend: function () { LP.blockContent(); }, success : function (response) { LP.unblockContent(); LP.ajax({ url: ‘Https://somedomain.com/api/Profile/setCourseCompleted?email=’+’[email protected]’+’&secretKey=xxx-xxxx-xxxx-xxxx’, type: ‘GET’, success: function(data){ alert(data); } }); learn_press_update_item_content $.isFunction(args.callback) && args.callback.call(args.context, response, that); } });
-
February 12, 2018 at 11:26 AM #262103adislicParticipant
Anyone? I really need this solved asap. Thanks.
-
February 12, 2018 at 2:19 PM #262232AnonymousInactive
Dear adislic,
Sorry for the delay.
Please let me know the email that you want to user can get after finish course.
Because by now, we support to send main after finish course.
I’ll help you check it
Best regards,
Huyen Anh
-
February 12, 2018 at 7:33 PM #262492adislicParticipant
I don’t want to send email to user, i need to get email address of current user so i can put it in API call ( instead hardcoded , test email i am using now).
-
February 13, 2018 at 11:01 AM #262776AnonymousInactive
Dear adislic,
By now, we don’t support to get email address of user. But thanks for your feedback.
We’re working hard to add the email field for LearnPress – Gradebook add-on which you can check grade user. Please wait for you.
You can read here to know how to use LearnPress – Gradebook add-on: https://thimpress.com/product/gradebook-add-on-for-learnpress/
Best regards,
Huyen Anh
-
February 13, 2018 at 11:45 AM #262810adislicParticipant
Guys, i am just asking to get a help with the simple code that will give me email address of current user who clicks on “Finish Course”. I know how to get that info in php file(built-in WordPress get_user_data ) but since you are using ajax, i don’t know how to access wordpress standard function to get email of current user.
On wordpress support forum for your plugin, i asked same question and one of your developers gave me a code but it was not completely clear where to put the code that he wrote . Check here : https://wordpress.org/support/topic/ajax-action-finish-course-customization/#post-9965364
Can’t be that hard , i am sure that you guys have good idea how to do this since you are experts in wordpress and ajax.
I really need solution for this.
Thanks. -
February 13, 2018 at 12:00 PM #262822AnonymousInactive
Dear adislic,
With this issue, You should continue to discuss with Ken Nguyen on this forum: https://wordpress.org/support/topic/ajax-action-finish-course-customization/#post-9965364
He is a developer and he’ll help you. I’ll remind him to reply you.
Best regards,
Huyen Anh
-
-
AuthorPosts
You must be logged in to reply to this topic. You can click here