I am trying to pull a list of all courses that a user in a group is enrolled in. This is what I have so far. It is pulling the group members, but it’s pulling a list of all my enrolled courses instead of just the ones they are enrolled in.
<Loop query=group_users>
<Note>Save user ID for current Loop Iteration</Note>
<Set group_user_id><Field id /></Set>
<a class="user-link text-bold" href="{Field archive_url}">
<div class="mr-2 avatar text-xs"><Field avatar size=32 /></div>
<span><Field display_name /></span>
</a>
<Note>Loop through each course</Note>
<Loop query=all_courses user_id="{Get group_user_id}" enrolled=true>
<Note>Set up math variable</Note>
<Math>completed_lessons = 0</Math>
<p><Field title /></p>
</Loop>
</Loop>
Using the Loop Type learndash_group should help you with what you wanted to achieve. You can check out Learndash - Group Documentation for more details but this integration requires the Loops & Logic Pro plugin. Let us know if you need more help. Thanks!
I tried this and it didn’t pull what I needed. It pulled all users and all courses whether they were enrolled or not, which means it is probably pulling my info still. I ended up creating a shortcode to pull what I needed though.