Support » Plugin: Nav Menu Roles » Using this plugin to with with LearnDash Groups

  • Hi,
    I wanted to see if this plugin was able in interface with LearnDash Groups? LearnDash is a plug we are using and I want to create pages only certain people can see and that’s based on the group they are in.

    Here is the email I got from the dev team. Can I use a custom post type value to determine who can see what? Can I point the plugin from inside functions to look at the groups that are available? Even just pointing me to some documentation on this would be helpful.

    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.

Viewing 1 replies (of 1 total)
  • Plugin Author helgatheviking

    (@helgatheviking)

    By default, Nav Menu Roles only works on WordPress “roles” so if LD Groups aren’t “roles” then they will not be automatically added. However, NMR is extensible and you can add “pseudo roles” yourself with some custom code. As an example, here is a plugin that adds WooCommerce memberships’ “levels” to Nav Menu Roles:

    https://github.com/helgatheviking/nav-menu-roles-woocommerce-memberships

    Keep in mind though, that NMR doesn’t control access to the page itself, just the visibility of the menu item.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.