Closed lucasBruma closed 1 year ago
Hey @lucasBruma. I had to take a look at how LearnDash saves the blocks in the database.
Unfortunately it doesn't do it properly. It only saves an shortcode parameter and nothing else so parsing the block will return nothing.
Upon closer look it seems that it does not declare how the editor will extract the block properties from the markup but instead it uses some internal mechanism to resolve the data.
Also the LearndashLdProfile
does not contain any innerBlocks as far as I can tell.
You can use the following query to get some extra info but it would be all useless:
editorBlocks {
apiVersion
name
... on LearndashLdProfile {
attributes {
perPage
className
expandAll
showQuizzes
userId
order
showSearch
showHeader
order
orderby
}
innerBlocks {
renderedHtml
}
}
TBH in the current state I don't think that LearnDash blocks are supported out of the box sadly.
I will keep this issue in a couple of days for feedback.
Hi @theodesp, thank you for your help. What do you think is the best approach in these cases? Do you think using their API to get the data (e.g.: profile info) and rendering it with my custom components is best? Or there's anything else that may be simpler? Also, asking just in case, do you know any LMS plugin that fits better with wp-graphql-content-blocks
?
Thank you.
Hey @lucasBruma. I'm not familiar with the Learndash internals so I cannot really help you here. If Learndash was storing the block attributes the way that Gutenberg Core builds its blocks then this would be quite straightforward.
TBH. If i were to try to implement an LMS in Headless, I would just declare my own custom post types with ACF or Genesis Custom Blocks which are both supported with this plugin.
Here is a hypothetical entity relationship diagram for an LMS:
Course: Student Instructor Admin Lesson Quiz Assignment Grade Forum Resource
Hi all, I'm also not familiar enough with LearnDash to provide much help here, but I did run across this Gist to add LearnDash data to WPGraphQL. Hopefully that helps.
I don't think there's anything actionable here at the moment for this plugin, so I'll close this out. But please reopen if you continue to explore and run into any issues @lucasBruma!
Hi! I’m trying to fetch and render LearnDash blocks. I’m doing the following query:
And getting the following result:
Instead of getting the whole component flattened tree, I only get the top one. I’m not a WordPress expert, so I’m not sure what’s happening here or how I can customize LearnDash so I can query it with GraphQL. Any input on how to do it helps, thanks!