database - How to track user progress?

admin2025-04-21  1

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!

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!

Share Improve this question asked Jul 31, 2018 at 21:14 dkeelingdkeeling 3391 gold badge2 silver badges11 bronze badges 2
  • 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 Commented Aug 2, 2018 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 Commented Aug 2, 2018 at 14:12
Add a comment  | 

1 Answer 1

Reset to default 1

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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745215635a290832.html

最新回复(0)