function getPostList($echo = false) { global $current_user; $this->getPosts(); if (!empty($this->posts)) { ob_start(); ?> <ul id="pmpro_series-<?php echo $this->id; ?> " class="pmpro_series_list"> <?php $member_days = pmpro_getMemberDays($current_user->ID); foreach ($this->posts as $sp) { $days_left = ceil($sp->delay - $member_days); $date = date(get_option("date_format"), strtotime("+ {$days_left} Days", current_time("timestamp"))); ?> <li> <?php if (max(0, $member_days) >= $sp->delay) { ?> <span class="pmpro_series_item-title"><a href="<?php echo get_permalink($sp->id); ?> "><?php echo get_the_title($sp->id); ?> </a></span> <span class="pmpro_series_item-available"><a class="pmpro_btn pmpro_btn-primary" href="<?php echo get_permalink($sp->id); ?> ">Available Now</a></span> <?php } else { ?> <span class="pmpro_series_item-title"><?php echo get_the_title($sp->id); ?> </span> <span class="pmpro_series_item-unavailable">available on <?php echo $date; ?> </span> <?php } ?> <div class="clear"></div> </li> <?php } ?> </ul> <?php $temp_content = ob_get_contents(); ob_end_clean(); //filter $temp_content = apply_filters("pmpro_series_get_post_list", $temp_content, $this); if ($echo) { echo $temp_content; } return $temp_content; } return false; }
function pmpros_pmpro_text_filter($text) { global $wpdb, $current_user, $post; if (!empty($current_user) && !empty($post)) { if (!pmpros_hasAccess($current_user->ID, $post->ID)) { //Update text. The either have to wait or sign up. $post_series = get_post_meta($post->ID, "_post_series", true); $inseries = false; foreach ($post_series as $ps) { if (pmpro_has_membership_access($ps)) { $inseries = $ps; break; } } if ($inseries) { //user has one of the series levels, find out which one and tell him how many days left $series = new PMProSeries($inseries); $day = $series->getDelayForPost($post->ID); $member_days = pmpro_getMemberDays($current_user->ID); $days_left = ceil($day - $member_days); $date = date(get_option("date_format"), strtotime("+ {$days_left} Days", current_time("timestamp"))); $text = "This content is part of the <a href='" . get_permalink($inseries) . "'>" . get_the_title($inseries) . "</a> series. You will gain access on " . $date . "."; } else { //user has to sign up for one of the series if (count($post_series) == 1) { $text = "This content is part of the <a href='" . get_permalink($post_series[0]) . "'>" . get_the_title($post_series[0]) . "</a> series."; } else { $text = "This content is part of the following series: "; $series = array(); foreach ($post_series as $series_id) { $series[] = "<a href='" . get_permalink($series_id) . "'>" . get_the_title($series_id) . "</a>"; } $text .= implode(", ", $series) . "."; } } } } return $text; }