In this post, we will show you how to restrict LearnDash courses to users with a minimum number of enrolled courses.
Normally, you can set LearnDash courses as a prerequisite for a course. However, you can’t set a minimum number of posts as a requirement to take a specific course(s). For example, you can’t set a free course as a prize for users who enroll in three courses.
If you want to restrict LearnDash courses to users with a minimum number of enrolled courses, you would normally have to program that conditional restriction, or you’d have to hire a professional programmer who would take some time and that would cost a good amount of money.
Fortunately, you don’t have to program nor hire a programmer. You can easily restrict courses to users with a minimum number of enrolled courses using the WordPress Conditional Post Restrictions plugin.
It’s a WordPress plugin that allows you to apply conditional restrictions to your posts, pages, courses, events, downloads, podcast episodes, products, etc. You just need a few clicks and some simple fields to apply endless conditions to your content, in this case, courses.
You need to follow these simple steps to restrict courses to users with a minimum number of enrolled courses.
1- Install the “WordPress Conditional Post Restrictions” plugin
Important. This tutorial assumes you already have the LearnDash plugin and have created the courses you want to restrict. Therefore, you just need to install the WordPress Conditional Post Restrictions plugin.
You can download the plugin here:
Download WordPress Conditional Post Restrictions Plugin - or - Read more
After installing and activating the plugin, you can proceed to restrict your courses to users enrolled in a minimum number of courses.
2- Restrict courses to users enrolled in at least three courses
Here we show you how to restrict coursesto users with a minimum number of enrolled courses.
You need to open the list of courses. Go to LearnDash LMS > Courses.
Once you’re in the list of courses, you need to open the course you’ll edit. For example, we’ll edit the WooCommerce Course on our list, so we need to open the editor.
Once you open the course you’ll edit, scroll down to the Restriction Rules section, and select the following values to restrict this course for users with a minimum number of enrolled courses:
- Enable conditional restrictions: Yes
- What happens when the conditions are met: Allow access
- Condition 1: User enrolled courses count = 2. (This 2 is just an example; you decide how many courses to set as the condition to access this course.)
- Update the course to save the changes.
With these simple values, you can restrict a course for all users with a minimum number of enrolled courses. If you want to restrict other courses, you need to repeat these same steps on other courses.
3- How to restrict courses to users enrolled in at least three courses, including a specific course
If among the number of minimum courses you want to include a specific course, you can easily create that condition with WordPress Conditional Post Restrictions.
For example, you may want users to take the WordPress Course and any other course of their choice in order to take a restricted course. In this case, you need to take almost the same steps from the previous section:
- Open your courses list.
- Open the course you’ll edit.
- Scroll down to the Restriction Rules section.
Once there, you need to select the following values to restrict courses to users with a minimum number of enrolled courses, including a specific course in the condition:
- Enable conditional restrictions: Yes
- What happens when the conditions are met: Allow access
- Condition 1: User enrolled courses count = 2. (This 2 is just an example; you decide how many courses to set as the condition to access this course.)
- Click the + button in the Condition 1 to add an “and” condition.
- Condition 2: User is enrolled to course = WordPress course
- Update the course to save the changes.
This is how you can restrict courses to users with a minimum number of enrolled courses, including a specific course in the condition.
The users must be enrolled in two courses, including the WordPress Course. Of course, it’s just an example and you’re free to select the number of courses and the specific course you want to include in the condition.
4- What happens when users try to access a restricted course?
If users try to access a restricted course (they don’t meet the course conditions), you can decide if they will be shown a message, if they will be redirected to any URL of your choice, etc.
You can apply these changes in the plugin’s global settings. For that, go to Settings > Post Restrictions, and you’ll see these fields and options:
- By default, we will not apply restrictions for administrators, editors, and any user with the capability edit_others_posts.
- When courses are restricted, you can:
- Redirect to URL
- Remove the content and show a message
- Show fragment of the content and show message after fragment
- When categories are restricted, you can:
- Show error 404
- Show the normal page without posts
- Show an error message
- Redirect to another URL
- Show the content of another page
Restricting courses is really simple!
As you see, you don’t have to use any snippets, nor do you need any programming knowledge. You just need a few clicks and play with some simple clicks to apply this and any other restrictions to your LeardDash courses.
You can download the plugin here:
Download WordPress Conditional Post Restrictions Plugin - or - Read more