How to Suppress Hidden Lessons and Topics on LearnDash Course Pages

Requires Modification of LearnDash Templates

This patch is for LearnDash displayed courses, and does not work with 3rd Party Templates such as BuddyBoss Social Learner.

Filename: /wp-content/plugins/sfwd-lms/templates/course.php
Filename: /wp-content/plugins/sfwd-lms/templates/course_content_shortcode.php

Add the following code near the top of the file, after the comments.

This code walks the lesson and topics arrays provided to the template, and rebuilds them without any of the content shielded by Memberium content protection.

<?php
// Start Memberium Code

if ( function_exists( 'memb_hasPostAccess' ) ) {
$i = array();
foreach( $lessons as $lesson ) {
if ( memb_hasPostAccess( $lesson['post']->ID ) ) {
$i[] = $lesson;
}
}
$lessons = $i;
unset( $i, $lesson );

$i = array();
foreach( $lesson_topics as $lesson_id => $lesson_topic ) {
if ( memb_hasPostAccess( $lesson_id ) ) {
foreach( $lesson_topic as $array_id => $topic ) {
if ( memb_hasPostAccess( $topic->ID ) ) {
$i[$lesson_id][$array_id] = $topic;
}
}
}
}
$lesson_topics = $i;

unset( $i, $topic, $lesson_topic );
}

// End Memberium Code
?>
  • Was this Helpful?
  • YesNo
9 ways to add more value to your membership site

Table of Contents

Keep Reading

How to Use Memberium Partials

Partials are an often overlooked feature in Memberium used to help you manage your content. They are chunks of content that can be included into multiple places on your site. They don’t have their own URL and don’t show up in menus or searches. You insert a partial by using a shortcode on another page or post. You can include partials anywhere that shortcodes can be processed.

Read More »

How to create a Credit System with Infusionsoft and Memberium

Simply put, credit based systems allow your members to accumulate credits and spend them on services instead of using cash directly. As their credits increase either through buying or earning credits, they can then use those credits to buy additional access. Typically credits are earned either through one-time purchases, through subscriptions, or through performing activities. Credits are then redeemed either for an increased level of membership, or to buy access to content either on a permanent or temporary basis.

Read More »

Affiliate Leaderboards

For businesses that leverage affiliate sales, leaderboards can be a major component of a powerful part of your affiliate marketing strategy. Creating a visual leaderboard for your affiliates provides a shared resource that encourages your affiliates to compete with each other and increase the effectiveness of the overall campaign. Find out how affiliate leaderboards work with Memberium and how to set one up on your WordPress site.

Read More »

Want to get some fresh ideas on how you can improve your membership site or course?

Download our free ebook!

Book a Call

Welcome to Memberium!

We are very excited for you to be part of our family. 

We would love to answer any questions that you have!

Please choose the best time for you to get in a call with us. 

For Technical Support, you can contact us at https://keap.memberium.com/support/ or Email us at support@memberium.com.