Site Overlay

Bypass Drip Content for LearnDash

A couple of weeks ago I came up with the idea of designing a way to Bypass Drip Content in LearnDash in an simple way on a user per user basis and that also allows the user to mark the bypassed drip content as complete.

The Problem

Drip Content in LearnDash allows you to stop users from accessing a lesson immediately after they enroll in a course and sets them to wait for a certain period of time you configure in the lesson’s settings.

But there might be a case where you want to exclude some users from the drip content rule and grant them immediate access. Let’s you have a course that sells for $97 and every lesson is available every 7 days from one another.

Then say you want to offer a premium version of it at $297 and between the premium benefits give the users full access to all lessons at once.

To bypass drip content for LearnDash right now you’d need to either do a complex setup with a CRM and an automation tool like Zapier, Pabbly, WP Fusion, or change the user’s enrollment date manually for each user.

The Solution

The plugin I came up with Bypass Drip Content for LearnDash helps you bypass drip content on a lesson by lesson basis, picking users one by one or including users from a group at once (supports multiple groups).

You can download it for free from the repository in my GitHub account: https://github.com/j2machado/bypass-drip-content-for-learndash.

But what is drip content in LearnDash anyway?

Essentially, LearnDash LMS allows you to drip content by setting a release time in the Lesson Release Schedule option. You can access this option in the Lesson Settings. There are two ways to reach the Lesson Settings:

  1. Go to Lessons in the WordPress admin and select a lesson from the list.
    After selecting the lesson and the lesson edit screen loads, click the Settings tab at the top left area.
  2. Go to Courses in the WordPress admin and select any course.
    After selecting the course go to the Builder tab at the top menu.
    In the Lesson list below in the course builder, expand the Lesson you want to edit and click the Edit link.

No matter what process you choose, after selecting the Lesson, go to the Settings tab like so:

The Lesson Release Schedule option is the third option inside Lesson Access Settings:

You have three modes:

  1. Immediately – this enables access to the Lesson immediately (no drip).
  2. Enrollment-based. The lesson will be available X number of days after the user enrolled in a course.
  3. Specific date – The lesson will be available on a specific date regardless of the date the user enrolled in the course. If the current date is greater than the date specified in the “Specific Date” option, then the user will be granted immediate access.

After setting the Lesson Release Schedule for your lessons, the course content is now on a drip row.

To bypass drip content, LearnDash has a filter ld_lesson_access_from__visible_after.

This filter accepts three arguments, $lesson_access_from, $lesson_id, $user_id.

  • $lesson_access_from – The timestamp when the Lesson becomes available.
  • $lesson_id – The lesson post ID in WordPress.
  • $user_id – The user ID in WordPress.

You can set the filter to return 0 or the output of the PHP time() function and that will suffice to bypass the drip content like so:

add_filter( 'ld_lesson_access_from__visible_after' , 'bypass_drip_content_for_learndash');

function bypass_drip_content_for_learndash($lesson_access_from, $lesson_id, $user_id){
    return time(); //Can return 0 too.
}

But what about bypassing drip content for specific users, and ignore the remaining users?

That’s where Bypass Drip Content for LearnDash comes in handy.

Sure you can do your own logic making an array of user IDs then mapping that array with the current logged in user, etc. That’s basically what the Bypass Drip Content for LearnDash does already for you.

After installing and activating the plugin on your LearnDash website, go to the Settings tab in the lesson you want to enable bypass drip content and you’ll see the following at the very bottom of the Lesson Settings screen:

Click the radio switch to Enable Bypass Drip Content.

Then you’ll see two options get expanded:

  • Select Users to Bypass – Allows you to select specific users allowed to bypass the current lesson.
  • Select Groups to Bypass – Allows you to select groups. All members of any select groups are allowed to bypass the current lesson.

You can download the plugin completely for free from my GitHub account: https://github.com/j2machado/bypass-drip-content-for-learndash.

Leave a Reply

Your email address will not be published. Required fields are marked *