5

I'm looking to build a very lightweight learning management system of sorts. I'll have 2 custom post types "Course" and "Lesson". I will associate the Lessons to the Courses, probably by using the Advanced Custom Fields plugin.

What I need to do is somehow track whether or not a user has "completed" or "viewed" a specific Lesson. I'll probably add a button that says "Mark as Complete" or something.

The question is, what information should I be saving, and how should I be saving it (when the user clicks the button)? Further, what table in the DB should this information be saved in?

I see that there are some plugins out there like WP Complete, but it doesn't offer exactly what I need. I'm open to any ideas/recommendations. Thanks!

  • 1
    You can use users custom meta with the information of courses or lessons completed. you can use update_user_meta($user_id,'lessons_completed','lesson_id') or more complicated (lessons ids seperated with comma etc.) . Or Reverse! Add completed_users to lessons or courses custom metas and after that add user ids – Serkan Algur Aug 2 '18 at 8:44
  • 1
    That's a good idea. I've started down the path of creating a separate table to relate users to lessons, but I'm still open to different/new/better ideas. Thank you! – dkeeling Aug 2 '18 at 14:12
0

If you're using ACF you can also attach custom fields to users. You can attach them by using the Location Rules (the ones in the 'User' subgroup), see Creating custom user profile pages with ACF

You could add a single relational → post object field in a field group, Filter by Post TypeLesson.

Then you could use a front-end form which you can pre-populate with that specific lesson (see: Pre-populate Relationship field...) – then you might also want to hide the input with CSS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.