I'm currently trying to extract data from an LMS plugin called Tutor LMS, which can generate courses, with associated lessons. I'm able to get a lot of data from the plugin, with keys like "_tutor_course_requirements" or "_tutor_course_benefits", but I don't see any key linked to associated lessons. From what I gathered from the database, lessons are a different post type, associated by a parent post system to the course it is attached to (for example, the value of the parent post id of all lessons associated to my course is 31)
My question is, even if the template is set to a specific post type (course), is it possible to gather multiple data from a different post type (lesson) if there is a value in common (parent post id) ? Also I tried to see which key of the course can generate the parent post id of the lesson, but I didn't find it in the proposed fields, is there a conditionnal system that can help me here?
Thanks a lot for the answers, and I'll be glad to help if you need any more information!
16 September, 2021 04:46:31
fabcoo
Topics: 2
Messages: 6
Just to extend, after more research I found that the output of the course topics is rendered via the function tutor_course_topics() in the template, is it possible to stock the HTML output in a key by a custom function, so it can be show as an HTML object on the PDF template?
16 September, 2021 10:16:44
E2Pdf
Support
Topics: 7
Messages: 3574
Hi,
As we understand you connected E2Pdf Template to "Courses". Unfortunately related post data is still under development and beta test, so it's not yet documented, however here is possible solutions:
It will iterate over child posts of course to get "topics" and after this it will iterate over "topics" to get "lessons". You can see that it's possible to use default "[e2pdf-wp]" shortcode inside "[e2pdf-foreach]" iteration. If it will fit your needs and you will need different order or some additional conditions, fill free to ask as we do not yet have documentation for current shortcodes due the "beta" stage.
P.S. It's also recommended to "Disable WYSIWYG Editor" on E2Pdf HTML object to avoid breaking "HTML" tags due verification by WYSIWYG Editor via "Right Mouse Click" -> "Properties"
OR
2. You can create own shortcode via functions.php as: https://codeshare.io/gLe3jB and use needed PHP functions to generate needed output. Inside E2Pdf Template you must be able to use it as follows: [myshortcode id="[e2pdf-dataset]"]
* [e2pdf-dataset] - will be converted to your Post ID for which E2Pdf generates PDF (in your way it must Course ID)
P.P.S. Both solutions will require RC Version.
We remain at your service.
17 September, 2021 00:23:42
fabcoo
Topics: 2
Messages: 6
Thanks a lot for the answers, I'll check this today and get back to you!
17 September, 2021 06:06:47
fabcoo
Topics: 2
Messages: 6
I tested your code, and it worked great! Now I have all the listing of topics and lessons associated, and correctly linked to the course, thanks a lot!
I used your first snippet by the way, and I customized it a little in the "properties" textarea to get the HTML output I wanted, and it looked like that :
We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. By clicking "Accept Selected", you consent to use of selected cookies according our to our Cookie Policy.