Hi,
I am trying to get a "Mark as complete" functionality for my website. We offer various classes with videos and most of our clients say they have issues keeping track of the classes they've already taken. We were hoping there was such functionality because most of the classes are Toolset Types.
I have attached a loom indicating what we're looking for.
knitfreedom.com
hidden link
hidden link
Hello,
Thanks for the videos, there isn't such kind of built-in feature within Toolset plugins, you might consider custom codes.
In my opinion, it needs these:
1) Three post types:
- Class
- Lesson
- Student (each Student post's author is one WordPress user, Each WordPress user can have only one Student post)
https://toolset.com/course-lesson/how-to-create-custom-searches-and-relationships-for-users/
2) Setup below post type relationships:
- One-to-many relationship between "Class" and "Lesson"
- many-to-many relationships between "Class" and "Student", in the intermediary post type, add a custom field "Completed"
- many-to-many relationships between "Lesson" and "Student", in the intermediary post type, add a custom field "Completed"
https://toolset.com/course-lesson/how-to-set-up-post-relationships-in-wordpress/
3) In single "Lesson" post, you can display a relationship form for user to connect his "Student" with current "Lesson" post:
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/
After user submit the relationship form, use action hook "toolset_association_created" to trigger a PHP function, in this PHP function, do these:
1) Get the related class post by the current "Lesson" post
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post
2) Get the all related Lesson posts by above class post ID
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
3) Get related intermediary posts between "Lesson" posts and current "Student" post, if all intermediary post's "Completed" field values are completed, then update the "Completed" field value of intermediary post between "Class" and current "Student" post to be "completed".
https://developer.wordpress.org/reference/functions/get_post_meta/
https://developer.wordpress.org/reference/functions/update_post_meta/
For your reference.
Hi Luo,
Thanks for your response. I was hoping we could leave this ticket open for another 24 hours while I go through the documentation and links you have provided just in case I may have follow-up questions.
I have marked this thread as "Waiting for feedback" status, you can update here if needs more assistance for it.