Ken,
Let me first say I love the plugin and it works real well for me. However, since I am one of many people that were looking for this solution and in the spirit of WordPress being open source, I post the solution for hiding the Lesson from the Course Curriculum list until it is available to the user via Content Drip.
The file you need to modify is single-course > section > item-lesson.php. When you look at the file, you will see that this is where the “li” tags and links are generated for the Lesson list. Basically, the issue is pulling the Lesson’s start time into this page.
First, you need to add the following code right after “$item_link = $viewable ? ‘href=”‘ . $course->get_item_link( $item->ID ) . ‘”‘ : ”;
?>” on line 16
<?php
$course_id = get_the_ID();
//$course = LP()->global[‘course’];
$block_content = false;
$user = learn_press_get_current_user();
$lesson_id = $item->ID;
$new_course_info = $user->get_course_info( $course_id );
//if ( !$this->_course_info ) {
// $block_content = true;
// }
//BLOCKprint_r( $this->_course_info );
// BLOCKensure the lesson is in a course as setting up
if ( $lesson_id && $item = LP_Lesson::get_lesson( $lesson_id ) ) {
$drip_type = $item->drip_content_date_become_available;
if ( $drip_type == ‘interval’ ) {
$interval = $item->drip_content_interval;
$new_lesson_start_time = strtotime( “+{$interval}”, strtotime( $new_course_info[‘start’] ) );
//$BLOCKED!!!type = $lesson->drip_content_interval_type;
// $this->date_available = strtotime( “+{$interval}”, strtotime( $this->_course_info[‘start’] ) );
//} elseif ( $drip_type == ‘specific_date’ ) {
// $date = $lesson->drip_content_specific_date;
// if ( $date ) {
// if ( preg_match_all( ‘!^(\d{2}) (.*) (\d{4})!’, $date, $matches ) ) {
//$date = $matches[3][0] . ‘/’ . $matches[2][0] . ‘/’ . $matches[1][0];
// }
// }
// $this->date_available = strtotime( $date );
}
//BLOCKED!echo $this->date_available ,’,’, current_time( ‘timestamp’ );die();
if ( $new_lesson_start_time > current_time( ‘timestamp’ ) ) {
$block_content = true;
}
}
//echo $new_lesson_start_time;
if ( $block_content ) {?>
<li style=”display: none;”>
<?php }
else {
?>
The next line should then be “<li <?php learn_press_course_item_class( $item->ID ); ?> data-type=”<?php echo $item->post_type; ?>”>”.
After the closing tag, add the following code: <?php }?>
That’s it. What I did was modify the plugin function to call the start time for each individual lesson based on the user. This is the crucial part that was very hard.
Again, I don’t mean to step on toes Ken, but a lot of people were looking for it. Maybe you can add this now as a plugin option?