Skip to content

Instantly share code, notes, and snippets.

@pgk
Created October 11, 2017 09:20
Show Gist options
  • Save pgk/e2c75ddaf8755422aa9bc2e928d90dc5 to your computer and use it in GitHub Desktop.
Save pgk/e2c75ddaf8755422aa9bc2e928d90dc5 to your computer and use it in GitHub Desktop.
Sensei: Show specific course/lesson status report for a learner
-- Sensei: Show specific course/lesson status report for a learner
--
-- Substitute table names and user id to match your setup
SELECT u.ID, COUNT(c.comment_type) AS `cnt`, c.comment_type AS `status_type`, c.comment_approved AS `status`
FROM `wp_users` AS u
JOIN `wp_comments` AS c ON u.ID = c.user_id
WHERE
c.comment_type IN ('sensei_course_status', 'sensei_lesson_status') AND
u.ID = 1
GROUP BY u.ID, c.comment_type, c.comment_approved;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment