Skip to content

Instantly share code, notes, and snippets.

@gera3d
Created November 7, 2017 19:06
Show Gist options
  • Save gera3d/98f20e66be6da001f53b8087ff1d2365 to your computer and use it in GitHub Desktop.
Save gera3d/98f20e66be6da001f53b8087ff1d2365 to your computer and use it in GitHub Desktop.
Just some notes on lerandash
Below are details on LearnDash Groups as requested:
LearnDash Groups ( slug: groups ) are a normal custom post type just like LearnDash Courses, or WooCommerce Products etc. Within the Group LearnDash has 3 associations:
1. Group Leaders - ( role slug: group_leader ) - When a Group Leader user is associated with a course there is a user_meta record created with the meta_key 'learndash_group_leaders_XXX' and the meta_value 'XXX' where 'XXX' is the Group Post ID.
2. Group Users - Similar to the above Group Leader for group users there is a user_meta record created with the meta_key 'learndash_group_users_XXX' and meta_value 'XXX' where 'XXX' is the Group Post ID.
3. For Group Courses - ( slug: sfwd-courses ) - There is a post_meta record created to the Course Post ID with the meta_key 'learndash_group_enrolled_XXX' where 'XXX' is the Group Post ID. The meta_value will be a timestamp.
The majority of the LearnDash Groups management functionality is contained within the plugin code in includes/ld-groups.php there we have functions like:
learndash_group_has_course( $group_id, $course_id )
Used to check if a course is associated with a group
learndash_get_users_group_ids( $user_id = 0 )
For a User returns all Group Post IDs (array)
learndash_get_groups_users( $group_id )
For a Group ID return all associated User IDs.
We also have other functions like:
learndash_is_group_leader_user( $user_id )
Used to check if a specific User ID is a Group Leader.
------
Please let me know if you have any additional questions.
Thanks so much,
Amber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment