In this tutorial, we will show you how to restrict LearnDash courses for users enrolled in a specific course. This is very useful if you are offering a two-course promotion for the price of one and you want the requirement for the second course to be being enrolled in a specific course.
This way, you can use one course as a kind of coupon for your users and get more course sales. Remember that discount coupons, or in this case courses as coupons, are a great marketing strategy.
How does this restriction method differ from LearnDash’s Course prerequisites feature?
In LearnDash, you can perfectly restrict courses by setting a prerequisite course. That means users must complete a course in order to take another course. However, restricting courses for students enrolled in a specific course is different.
When you restrict any LearnDash course, users don’t have to complete the course. They can take both courses, the only requisite is to be enrolled in a specific course to access the second course. That’s why we tell you that one course can work perfectly as a discount coupon; two courses for the price of one.
What do you need to restrict courses to students enrolled in a specific course?
You don’t need to use any snippets. To restrict courses to students enrolled in a specific course, you need the WordPress Conditional Post Restrictions plugin, which allows you to set conditional restrictions for posts, pages, and any other custom post types such as courses, events, downloads, products, etc.
You can restrict LearnDash courses for users enrolled in specific courses, users enrolled in a specific number of courses, or both methods.
To restrict courses to users enrolled in a specific course, follow these simple steps:
1- Install the WordPress Conditional Post Restrictions plugin
You can download the plugin here:
Download WordPress Conditional Post Restrictions Plugin - or - Read more
This post assumes you have the LearnDash plugin and you’ve created the courses you want to use for the restrictions.
Therefore, after installing and activating the plugin, you can proceed to restrict courses to users enrolled in a specific course.
2- Restrict courses to users enrolled in a specific course
The first thing you need to restrict courses to users enrolled in a specific course is to open the list of LearnDash courses you’ve created.
You can open your course list by going to LearnDash LMS > Courses.
Now you need to open any course you’ll restrict. We’ll restrict the “WooCommerce Course“. We’ll use the “WordPress Course” as a condition to take the “WooCommerce Course” so we need to open it and scroll down to the Restriction Rules section.
Once there, you need to select the following values to restrict this course for all users enrolled in a specific course.
- Enable conditional restrictions: Yes
- What happens when the conditions are met: Allow access
- Condition 1: User is enrolled to course = WordPress course
- Update the course to save the changes.
What happens when users try to enter a course they’re not allowed in?
You have several options as to what happens when users don’t meet the condition of being enrolled in a specific course.
You need to configure the global settings of the plugin, so go to Settings > Post restrictions in wp-admin.
Now you’ll see these options to configure what happens when users try to access a course they’re not allowed in.
- Enable restrictions: Tick/untick this checkbox to enable/disable the global conditions.
- Don’t apply restrictions for these user roles: You’ll see a list of user roles for which the conditions won’t be applied. By default, we will not apply restrictions for administrators, editors, and any user with the capability edit_others_posts.
- These are the options you have when the course is restricted:
- Redirect to URL
- Remove the content and show a message
- Show fragment of the content and show message after fragment
- These are the options you have when the categories are restricted:
- Show error 404
- Show the normal page without posts
- Show an error message
- Redirect to another URL
- Show the content of another page
That’s really simple!
As you see, it’s really simple to use a course as a coupon to get a second course. You don’t need to use any PHP snippets nor know anything about programming.
WordPress Conditional Post Restrictions gives you endless possibilities to manage restrictions on any type of content of your WordPress website.
You can download the plugin here:
Download WordPress Conditional Post Restrictions Plugin - or - Read more