Exemple #1
0
    if (pmpro_isLevelTrial($level)) {
        if ($level->trial_amount == '0.00') {
            if ($level->trial_limit == '1') {
                echo ' ' . _x('After your initial payment, your first payment is Free.', 'Trial payment in cost text generation.', 'pmpro');
            } else {
                printf(' ' . _x('After your initial payment, your first %d payments are Free.', 'Trial payment in cost text generation.', 'pmpro'), $level->trial_limit);
            }
        } else {
            if ($level->trial_limit == '1') {
                printf(' ' . _x('After your initial payment, your first payment will cost %s.', 'Trial payment in cost text generation.', 'pmpro'), $pmpro_currency_symbol . $level->trial_amount);
            } else {
                printf(' ' . _x('After your initial payment, your first %d payments will cost %s.', 'Trial payment in cost text generation. E.g. ... first 2 payments will cost $5', 'pmpro'), $level->trial_limit, $pmpro_currency_symbol . $level->trial_amount);
            }
        }
    }
    $expiration_text = pmpro_getLevelExpiration($level);
    if ($expiration_text) {
        ?>
          <br /><span class="pmpro_level-expiration"><?php 
        echo $expiration_text;
        ?>
</span>
        <?php 
    }
    ?>
					
				<div class="pmpro-price">
					<p class="lead">
					<?php 
    if (pmpro_isLevelFree($level) || $level->initial_payment === "0.00") {
        ?>
				<div id="pmpro_level_cost">
					<?php 
if ($discount_code && pmpro_checkDiscountCode($discount_code)) {
    ?>
						<?php 
    printf(__('<p class="pmpro_level_discount_applied">The <strong>%s</strong> code has been applied to your order.</p>', 'pmpro'), $discount_code);
    ?>
					<?php 
}
?>
					<?php 
echo wpautop(pmpro_getLevelCost($pmpro_level));
?>
					<?php 
echo wpautop(pmpro_getLevelExpiration($pmpro_level));
?>
				</div>

				<?php 
do_action("pmpro_checkout_after_level_cost");
?>

				<?php 
if ($pmpro_show_discount_code) {
    ?>

					<?php 
    if ($discount_code && !$pmpro_review) {
        ?>
						<p id="other_discount_code_p" class="pmpro_small"><a id="other_discount_code_a" href="#discount_code"><?php 
_e('Click here to change your discount code', 'pmpro');
?>
</a>.');
		jQuery('#other_discount_code_p').show();
		
		jQuery('#other_discount_code_a').click(function() {
			jQuery('#other_discount_code_tr').show();
			jQuery('#other_discount_code_p').hide();			
		});
		
		jQuery('#pmpro_level_cost').html('<p><?php 
printf(__('The <strong>%s</strong> code has been applied to your order.', 'pmpro'), $discount_code);
?>
</p><p><?php 
echo pmpro_no_quotes(pmpro_getLevelCost($code_level), array('"', "'", "\n", "\r"));
echo pmpro_no_quotes(pmpro_getLevelExpiration($code_level), array('"', "'", "\n", "\r"));
?>
</p>');
		
		<?php 
//tell gateway javascripts whether or not to fire (e.g. no Stripe on free levels)
if (pmpro_isLevelFree($code_level)) {
    ?>
				pmpro_require_billing = false;
			<?php 
} else {
    ?>
				pmpro_require_billing = true;
			<?php 
}
//hide/show billing
Exemple #4
0
function memberlite_levels_shortcode($atts, $content = null, $code = "")
{
    // $atts    ::= array of attributes
    // $content ::= text within enclosing form of shortcode element
    // $code    ::= the shortcode found, when == callback name
    // examples: [memberlite_levels levels="1,2,3" layout="table" hightlight="2" description="false" checkout_button="Register Now"]
    extract(shortcode_atts(array('account_button' => 'Your Level', 'back_link' => '1', 'checkout_button' => 'Select', 'compare' => NULL, 'description' => '1', 'discount_code' => NULL, 'expiration' => '1', 'highlight' => NULL, 'layout' => 'div', 'levels' => NULL, 'more_button' => NULL, 'price' => 'short', 'renew_button' => 'Renew'), $atts));
    global $wpdb, $pmpro_msg, $pmpro_msgt, $current_user, $pmpro_currency_symbol, $pmpro_all_levels, $pmpro_visible_levels, $current_user, $membership_levels;
    //turn 0's into falses
    if ($back_link === "0" || $back_link === "false" || $back_link === "no") {
        $back_link = false;
    } else {
        $back_link = true;
    }
    if ($compare === "0" || $compare === "false" || $compare === "no") {
        $compare = false;
    } else {
        $compareitems = explode(";", $compare);
    }
    if ($description === "0" || $description === "false" || $description === "no") {
        $description = false;
    } else {
        $description = true;
    }
    if ($expiration === "0" || $expiration === "false" || $expiration === "no") {
        $expiration = false;
    } else {
        $expiration = true;
    }
    if ($more_button === "0" || $more_button === "false" || $more_button === "no" || empty($more_button)) {
        $more_button = false;
    } elseif ($more_button === "1" || $more_button === "true" || $more_button === "yes") {
        $more_button = "Read More";
    }
    if ($price === "0" || $price === "false" || $price === "hide") {
        $show_price = false;
    } else {
        $show_price = true;
    }
    if (function_exists('pmpro_getAllLevels')) {
        ob_start();
        //make sure pmpro_levels has all levels
        if (!isset($pmpro_all_levels)) {
            $pmpro_all_levels = pmpro_getAllLevels(true, true);
        }
        if (!isset($pmpro_visible_levels)) {
            $pmpro_visible_levels = pmpro_getAllLevels(false, true);
        }
        if ($pmpro_msg) {
            ?>
			<div class="pmpro_message <?php 
            echo $pmpro_msgt;
            ?>
"><?php 
            echo $pmpro_msg;
            ?>
</div>
			<?php 
        }
        $pmpro_levels_filtered = array();
        if (!empty($levels)) {
            $levels_order = explode(",", $levels);
            //loop through $levels_order array and pull levels from $levels
            foreach ($levels_order as $level_id) {
                foreach ($pmpro_all_levels as $level) {
                    if ($level->id == $level_id) {
                        $pmpro_levels_filtered[$level->id] = $level;
                        break;
                    }
                }
            }
        } else {
            $pmpro_levels_filtered = $pmpro_visible_levels;
        }
        $pmpro_levels_filtered = apply_filters("pmpro_levels_array", $pmpro_levels_filtered);
        $numeric_levels_array = array_values($pmpro_levels_filtered);
        //update per discount code
        if (!empty($discount_code) && !empty($pmpro_levels_filtered)) {
            foreach ($pmpro_levels_filtered as $level_id => $level) {
                //check code for this level and update if applicable
                if (pmpro_checkDiscountCode($discount_code, $level->id)) {
                    $sqlQuery = "SELECT l.id, cl.*, l.name, l.description, l.allow_signups FROM {$wpdb->pmpro_discount_codes_levels} cl LEFT JOIN {$wpdb->pmpro_membership_levels} l ON cl.level_id = l.id LEFT JOIN {$wpdb->pmpro_discount_codes} dc ON dc.id = cl.code_id WHERE dc.code = '" . $discount_code . "' AND cl.level_id = '" . (int) $level->id . "' LIMIT 1";
                    $pmpro_levels_filtered[$level_id] = $wpdb->get_row($sqlQuery);
                    $pmpro_levels_filtered[$level_id]->base_level = $level;
                }
            }
        }
        if ($layout == 'table') {
            ?>
			<table id="pmpro_levels" class="pmpro_levels-table">
			<thead>
			  <tr>
				<th><?php 
            _e('Level', 'pmpro');
            ?>
</th>
				<?php 
            if (!empty($show_price)) {
                ?>
					<th><?php 
                _e('Price', 'pmpro');
                ?>
</th>	
				<?php 
            }
            ?>
				<?php 
            if (!empty($expiration)) {
                ?>
					<th><?php 
                _e('Expiration', 'pmpro');
                ?>
</th>
				<?php 
            }
            ?>
				<th>&nbsp;</th>
			  </tr>
			</thead>
			<tbody>
			<?php 
            $count = 0;
            foreach ($pmpro_levels_filtered as $level) {
                if (isset($current_user->membership_level->ID)) {
                    $current_level = $current_user->membership_level->ID == $level->id;
                } else {
                    $current_level = false;
                }
                ?>
				<tr class="<?php 
                if ($current_level) {
                    echo 'pmpro_level-current ';
                }
                if ($highlight == $level->id) {
                    echo 'pmpro_level-highlight ';
                }
                ?>
">
					<td>
						<h2><?php 
                echo $level->name;
                ?>
</h2>
						<?php 
                if (!empty($description)) {
                    echo wpautop($level->description);
                }
                ?>
						<?php 
                $level_page = memberlite_getLevelLandingPage($level->id);
                if (!empty($level_page)) {
                    ?>
								<p><a href="<?php 
                    echo get_permalink($level_page->ID);
                    ?>
"><?php 
                    echo $more_button;
                    ?>
</a></p>
								<?php 
                }
                ?>
					</td>
					<?php 
                if (!empty($show_price)) {
                    ?>
					<td>
						<?php 
                    if ($price === 'full') {
                        echo memberlite_getLevelCost($level, true, false);
                    } else {
                        echo memberlite_getLevelCost($level, true, true);
                    }
                    ?>
					</td>
					<?php 
                }
                ?>
					<?php 
                if (!empty($expiration)) {
                    ?>
							<td>
							<?php 
                    $level_expiration = pmpro_getLevelExpiration($level);
                    if (empty($level_expiration)) {
                        _e('Membership Never Expires.', 'pmpro');
                    } else {
                        echo $level_expiration;
                    }
                    ?>
							</td>
							<?php 
                }
                ?>
					<td>
					<?php 
                if (empty($current_user->membership_level->ID)) {
                    ?>
						<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
					<?php 
                } elseif (!$current_level) {
                    ?>
                	
						<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
					<?php 
                } elseif ($current_level) {
                    ?>
      
						
						<?php 
                    //if it's a one-time-payment level, offer a link to renew
                    if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                        ?>
								<a class="pmpro_btn pmpro_btn-select" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $renew_button;
                        ?>
</a>
							<?php 
                    } else {
                        ?>
								<a class="pmpro_btn disabled" href="<?php 
                        echo pmpro_url("account");
                        ?>
"><?php 
                        echo $account_button;
                        ?>
</a>
							<?php 
                    }
                    ?>
						
					<?php 
                }
                ?>
					</td>
				</tr>
				<?php 
            }
            ?>
			</tbody>
			</table>
			<?php 
        } elseif ($layout == 'compare_table') {
            ?>
			<table id="pmpro_levels" class="pmpro_levels-compare_table">
				<thead>
					<tr>
						<th><?php 
            _e('Level', 'pmpro');
            ?>
</th>
						<?php 
            $count = 0;
            foreach ($pmpro_levels_filtered as $level) {
                ?>
								<th class="<?php 
                if ($current_level) {
                    echo 'pmpro_level-current ';
                }
                if ($highlight == $level->id) {
                    echo 'pmpro_level-highlight ';
                }
                ?>
">
									<h2><?php 
                echo $level->name;
                ?>
</h2>
								</th>
								<?php 
            }
            ?>
					</tr>
					<?php 
            if (!empty($show_price)) {
                ?>
					<tr>
						<th><?php 
                _e('Price', 'pmpro');
                ?>
</th>
						<?php 
                foreach ($pmpro_levels_filtered as $level) {
                    ?>
								<th class="<?php 
                    if ($current_level) {
                        echo 'pmpro_level-current ';
                    }
                    if ($highlight == $level->id) {
                        echo 'pmpro_level-highlight ';
                    }
                    ?>
">
									<h1 class="primary">
									<?php 
                    if ($price === 'full') {
                        echo memberlite_getLevelCost($level, true, false);
                    } else {
                        echo memberlite_getLevelCost($level, true, true);
                    }
                    ?>
									</h1>
								</th>
								<?php 
                }
                ?>
					</tr>
					<?php 
            }
            ?>
					<?php 
            if (!empty($expiration)) {
                ?>
					<tr>
						<th><?php 
                _e('Expiration', 'pmpro');
                ?>
</th>
						<?php 
                foreach ($pmpro_levels_filtered as $level) {
                    ?>
								<th class="muted <?php 
                    if ($current_level) {
                        echo 'pmpro_level-current ';
                    }
                    if ($highlight == $level->id) {
                        echo 'pmpro_level-highlight ';
                    }
                    ?>
">
									<?php 
                    $level_expiration = pmpro_getLevelExpiration($level);
                    if (empty($level_expiration)) {
                        _e('Membership Never Expires.', 'pmpro');
                    } else {
                        echo $level_expiration;
                    }
                    ?>
								</th>
								<?php 
                }
                ?>
					</tr>
					<?php 
            }
            ?>
					<tr>
						<th>&nbsp;</th>
						<?php 
            foreach ($pmpro_levels_filtered as $level) {
                ?>
								<th class="<?php 
                if ($current_level) {
                    echo 'pmpro_level-current ';
                }
                if ($highlight == $level->id) {
                    echo 'pmpro_level-highlight ';
                }
                ?>
">
								<?php 
                if (empty($current_user->membership_level->ID)) {
                    ?>
									<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
								<?php 
                } elseif (!$current_level) {
                    ?>
                	
									<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
								<?php 
                } elseif ($current_level) {
                    ?>
      									
									<?php 
                    //if it's a one-time-payment level, offer a link to renew
                    if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                        ?>
											<a class="pmpro_btn pmpro_btn-select" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $renew_button;
                        ?>
</a>
										<?php 
                    } else {
                        ?>
											<a class="pmpro_btn disabled" href="<?php 
                        echo pmpro_url("account");
                        ?>
"><?php 
                        echo $account_button;
                        ?>
</a>
										<?php 
                    }
                    ?>
									
								<?php 
                }
                ?>
								</th>
								<?php 
            }
            ?>
					</tr>
				</thead>
				<tbody>
					<?php 
            if (!empty($compareitems)) {
                //var_dump($compareitems);
                foreach ($compareitems as $compareitem) {
                    ?>
							<tr>
							<?php 
                    $count = -1;
                    $compareitem_values = explode(",", $compareitem);
                    foreach ($compareitem_values as $compareitem_value) {
                        if ($count > 0 && !empty($numeric_levels_array[$count])) {
                            $level = $numeric_levels_array[$count];
                        } else {
                            $level = NULL;
                        }
                        $count++;
                        ?>
									<td class="<?php 
                        if ($current_level) {
                            echo 'pmpro_level-current ';
                        }
                        if (!empty($level) && $highlight == $level->id) {
                            echo 'pmpro_level-highlight ';
                        }
                        ?>
">
										<?php 
                        if ($compareitem_value == '1') {
                            echo '<i class="fa fa-check fa-2x success"></i>';
                        } elseif ($compareitem_value == '0') {
                            echo '<i class="fa fa-minus muted"></i>';
                        } else {
                            echo $compareitem_value;
                        }
                        ?>
									</td>
									<?php 
                    }
                    ?>
							</tr>
							<?php 
                }
            }
            ?>
				</tbody>
				<tfoot>
					<tr>
						<td>&nbsp;</td>
						<?php 
            foreach ($pmpro_levels_filtered as $level) {
                ?>
								<td class="<?php 
                if ($current_level) {
                    echo 'pmpro_level-current ';
                }
                if (!empty($level) && $highlight == $level->id) {
                    echo 'pmpro_level-highlight ';
                }
                ?>
">
								<?php 
                if (empty($current_user->membership_level->ID)) {
                    ?>
									<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
								<?php 
                } elseif (!$current_level) {
                    ?>
                	
									<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
								<?php 
                } elseif ($current_level) {
                    ?>
      									
									<?php 
                    //if it's a one-time-payment level, offer a link to renew
                    if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                        ?>
											<a class="pmpro_btn pmpro_btn-select" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $renew_button;
                        ?>
</a>
										<?php 
                    } else {
                        ?>
											<a class="pmpro_btn disabled" href="<?php 
                        echo pmpro_url("account");
                        ?>
"><?php 
                        echo $account_button;
                        ?>
</a>
										<?php 
                    }
                    ?>
									
								<?php 
                }
                ?>
								</td>
								<?php 
            }
            ?>
					</tr>
					<?php 
            if (!empty($expiration)) {
                ?>
					<tr>
						<td><?php 
                _e('Expiration', 'pmpro');
                ?>
</td>
						<?php 
                foreach ($pmpro_levels_filtered as $level) {
                    ?>
								<td class="muted <?php 
                    if ($current_level) {
                        echo 'pmpro_level-current ';
                    }
                    if ($highlight == $level->id) {
                        echo 'pmpro_level-highlight ';
                    }
                    ?>
">
									<?php 
                    $level_expiration = pmpro_getLevelExpiration($level);
                    if (empty($level_expiration)) {
                        _e('Membership Never Expires.', 'pmpro');
                    } else {
                        echo $level_expiration;
                    }
                    ?>
								</td>
								<?php 
                }
                ?>
					</tr>
					<?php 
            }
            ?>
					
					<?php 
            if (!empty($more_button)) {
                ?>
					<tr>
						<td><?php 
                _e('More Information', 'pmpro');
                ?>
</td>
						<?php 
                $count = 0;
                foreach ($pmpro_levels_filtered as $level) {
                    ?>
								<td class="<?php 
                    if ($current_level) {
                        echo 'pmpro_level-current ';
                    }
                    if (!empty($level) && $highlight == $level->id) {
                        echo 'pmpro_level-highlight ';
                    }
                    ?>
">
									<?php 
                    $level_page = memberlite_getLevelLandingPage($level->id);
                    if (!empty($level_page)) {
                        ?>
											<a href="<?php 
                        echo get_permalink($level_page->ID);
                        ?>
"><?php 
                        echo $more_button;
                        ?>
</a>
											<?php 
                    }
                    ?>
								</td>
								<?php 
                }
                ?>
					</tr>
					<?php 
            }
            ?>
					
				</tfoot>
			</table>	
			<?php 
        } else {
            ?>
			<div id="pmpro_levels" class="pmpro_levels-<?php 
            echo $layout;
            ?>
 row">
			<?php 
            $count = 0;
            foreach ($pmpro_levels_filtered as $level) {
                $count++;
                if (isset($current_user->membership_level->ID)) {
                    $current_level = $current_user->membership_level->ID == $level->id;
                } else {
                    $current_level = false;
                }
                ?>
				<div class="medium-<?php 
                if ($layout == 'div' || empty($layout)) {
                    echo '12';
                } elseif ($layout == '2col') {
                    echo '6';
                } elseif ($layout == '3col') {
                    echo '4';
                } elseif ($layout == '4col') {
                    echo '3';
                } else {
                    if (count($pmpro_levels) > 1) {
                        echo '12';
                    }
                }
                //if($count == 1 || ($layout == 'div' || empty($layout))) { echo '12'; }
                ?>
 columns">
				<div class="hentry post <?php 
                if ($current_level) {
                    echo 'pmpro_level-current ';
                }
                if ($highlight == $level->id) {
                    echo 'pmpro_level-highlight ';
                }
                ?>
">
					<h2><?php 
                echo $level->name;
                ?>
</h2>
					<?php 
                if ((!empty($description) || !empty($more_button)) && ($layout == 'div' || $layout == '2col' || empty($layout))) {
                    ?>
						<div class="entry-content">
							<?php 
                    echo wpautop($level->description);
                    ?>
							<?php 
                    $level_page = memberlite_getLevelLandingPage($level->id);
                    if (!empty($level_page)) {
                        ?>
									<p><a href="<?php 
                        echo get_permalink($level_page->ID);
                        ?>
"><?php 
                        echo $more_button;
                        ?>
</a></p>
									<?php 
                    }
                    ?>
						</div>
					<?php 
                }
                ?>
					<?php 
                if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                    ?>
						<footer class="entry-footer">	
						<?php 
                    if (empty($current_user->membership_level->ID)) {
                        ?>
								<a class="pmpro_btn pmpro_btn-select <?php 
                        if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                            echo 'alignright';
                        }
                        ?>
" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $checkout_button;
                        ?>
</a>
								<?php 
                    } elseif (!$current_level) {
                        ?>
                	
								<a class="pmpro_btn pmpro_btn-select <?php 
                        if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                            echo 'alignright';
                        }
                        ?>
" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $checkout_button;
                        ?>
</a>
								<?php 
                    } elseif ($current_level) {
                        //if it's a one-time-payment level, offer a link to renew
                        if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                            ?>
									<a class="pmpro_btn pmpro_btn-select <?php 
                            if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                                echo 'alignright';
                            }
                            ?>
" href="<?php 
                            echo pmpro_url("checkout", "?level=" . $level->id, "https");
                            ?>
"><?php 
                            echo $renew_button;
                            ?>
</a>
									<?php 
                        } else {
                            ?>
									<a class="pmpro_btn disabled <?php 
                            if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                                echo 'alignright';
                            }
                            ?>
" href="<?php 
                            echo pmpro_url("account");
                            ?>
"><?php 
                            echo $account_button;
                            ?>
</a>
									<?php 
                        }
                    }
                    ?>
						
						<?php 
                    if (!empty($show_price)) {
                        ?>
								<p class="pmpro_level-price">
								<?php 
                        if (pmpro_isLevelFree($level)) {
                            if (!empty($expiration)) {
                                ?>
											<strong><?php 
                                _e('Free.', 'pmpro');
                                ?>
</strong>
											<?php 
                            } else {
                                ?>
											<strong><?php 
                                _e('Free', 'pmpro');
                                ?>
</strong>
											<?php 
                            }
                        } elseif ($price === 'full') {
                            echo memberlite_getLevelCost($level, true, false);
                        } else {
                            echo memberlite_getLevelCost($level, true, true);
                        }
                        ?>
								</p>
								<?php 
                    }
                    ?>
		
						<?php 
                    if (!empty($expiration)) {
                        $level_expiration = pmpro_getLevelExpiration($level);
                        if (empty($level_expiration)) {
                            _e('Membership Never Expires.', 'pmpro');
                        } else {
                            echo $level_expiration;
                        }
                    }
                    ?>
						<?php 
                    if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                        echo '<div class="clear"></div>';
                    }
                    ?>
						</footer> <!-- .entry-footer -->
						<?php 
                } else {
                    //This is a column-type div layout
                    ?>
							<div class="entry-content">
								<?php 
                    if (!empty($show_price)) {
                        ?>
										<p class="pmpro_level-price">
										<?php 
                        if ($price === 'full') {
                            echo memberlite_getLevelCost($level, true, false);
                        } else {
                            echo memberlite_getLevelCost($level, true, true);
                        }
                        ?>
										</p>
										<?php 
                    }
                    ?>
								
								<p class="pmpro_level-select"><?php 
                    if (empty($current_user->membership_level->ID)) {
                        ?>
										<a class="pmpro_btn pmpro_btn-select" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $checkout_button;
                        ?>
</a>
										<?php 
                    } elseif (!$current_level) {
                        ?>
                	
										<a class="pmpro_btn pmpro_btn-select" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $checkout_button;
                        ?>
</a>
										<?php 
                    } elseif ($current_level) {
                        //if it's a one-time-payment level, offer a link to renew
                        if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                            ?>
											<a class="pmpro_btn pmpro_btn-select" href="<?php 
                            echo pmpro_url("checkout", "?level=" . $level->id, "https");
                            ?>
"><?php 
                            echo $renew_button;
                            ?>
</a>
											<?php 
                        } else {
                            ?>
											<a class="pmpro_btn disabled" href="<?php 
                            echo pmpro_url("account");
                            ?>
"><?php 
                            echo $account_button;
                            ?>
</a>
											<?php 
                        }
                    }
                    ?>
</p>

								<?php 
                    if (!empty($description)) {
                        echo wpautop($level->description);
                    }
                    ?>
								
								<?php 
                    $level_page = memberlite_getLevelLandingPage($level->id);
                    if (!empty($level_page)) {
                        ?>
										<p><a href="<?php 
                        echo get_permalink($level_page->ID);
                        ?>
"><?php 
                        echo $more_button;
                        ?>
</a></p>
										<?php 
                    }
                    ?>
						</div> <!-- .entry-content -->		
						<?php 
                    if (!empty($expiration)) {
                        echo '<footer class="entry-footer pmpro_level-expiration">';
                        $level_expiration = pmpro_getLevelExpiration($level);
                        if (empty($level_expiration)) {
                            _e('Membership Never Expires.', 'pmpro');
                        } else {
                            echo $level_expiration;
                        }
                        echo '</footer>';
                    }
                    ?>

							<?php 
                }
                ?>
				</div></div>
				<?php 
            }
            ?>
			</div> <!-- #pmpro_levels, .row -->
			<?php 
        }
        //end else if no layout specified, use 'div'
        ?>
			
		<?php 
        if (!is_page_template('templates/interstitial.php') && !empty($back_link)) {
            ?>
 
		<nav id="nav-below" class="navigation" role="navigation">
			<div class="nav-previous alignleft">
				<?php 
            if (!empty($current_user->membership_level->ID)) {
                ?>
					<a href="<?php 
                echo pmpro_url("account");
                ?>
"><?php 
                _e('&larr; Return to Your Account', 'pmpro');
                ?>
</a>
				<?php 
            } else {
                ?>
					<a href="<?php 
                echo home_url();
                ?>
"><?php 
                _e('&larr; Return to Home', 'pmpro');
                ?>
</a>
				<?php 
            }
            ?>
			</div>
		</nav>	
		<?php 
        }
        ?>
		
		<?php 
        $temp_content = ob_get_contents();
        ob_end_clean();
        return $temp_content;
    }
}
function getLevels()
{
    global $current_user;
    if ($current_user->ID) {
        $current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);
    }
    //is there a default level to redirect to?
    if (defined("PMPRO_DEFAULT_LEVEL")) {
        $default_level = intval(PMPRO_DEFAULT_LEVEL);
    } else {
        $default_level = false;
    }
    if ($default_level) {
        wp_redirect(pmpro_url("checkout", "?level=" . $default_level));
        exit;
    }
    global $wpdb, $pmpro_msg, $pmpro_msgt;
    if (isset($_REQUEST['msg'])) {
        if ($_REQUEST['msg'] == 1) {
            $pmpro_msg = __('Your membership status has been updated - Thank you!', 'pmpro');
        } else {
            $pmpro_msg = __('Sorry, your request could not be completed - please try again in a few moments.', 'pmpro');
            $pmpro_msgt = "pmpro_error";
        }
    } else {
        $pmpro_msg = false;
    }
    global $pmpro_levels;
    $pmpro_levels = pmpro_getAllLevels(false, true);
    $pmpro_levels = apply_filters("pmpro_levels_array", $pmpro_levels);
    if ($pmpro_msg) {
        ?>
        <div class="pmpro_message <?php 
        echo $pmpro_msgt;
        ?>
"><?php 
        echo $pmpro_msg;
        ?>
</div>
        <?php 
    }
    ?>

    <div id="main" class="site-main clr">
        <div id="membership-wrapper"> 
            <?php 
    $count = 0;
    $count_levels = count($pmpro_levels);
    $tmp = 0;
    foreach ($pmpro_levels as $level) {
        if (isset($current_user->membership_level->ID)) {
            $current_level = $current_user->membership_level->ID == $level->id;
        } else {
            $current_level = false;
        }
        ?>

                <?php 
        $last = $count_levels - $tmp;
        ?>
  
                <?php 
        $tmp = $tmp + 1;
        ?>

                <div class="box-level <?php 
        if ($count++ % 2 == 0) {
            ?>
odd<?php 
        } else {
            ?>
 even<?php 
        }
        if ($current_level == $level) {
            ?>
 active<?php 
        }
        if ($last == 2 || $last == 1) {
            ?>
 last-box<?php 
        }
        ?>
">
                    <h1><?php 
        echo $current_level ? "<strong>{$level->name}</strong>" : $level->name;
        ?>
</h1>
                    <div class="copy">
                        <?php 
        if (pmpro_isLevelFree($level)) {
            $cost_text = "<strong>Free</strong>";
        } else {
            $cost_text = pmpro_getLevelCost($level, true, true);
        }
        $expiration_text = pmpro_getLevelExpiration($level);
        if (!empty($cost_text) && !empty($expiration_text)) {
            echo $cost_text . "<br />" . $expiration_text;
        } elseif (!empty($cost_text)) {
            echo $cost_text;
        } elseif (!empty($expiration_text)) {
            echo $expiration_text;
        }
        ?>
                    </div>
                    <div class="links">
                        <?php 
        if (empty($current_user->membership_level->ID)) {
            ?>
                            <a class="pmpro_btn pmpro_btn-select sign-up" href="<?php 
            echo pmpro_url("checkout", "?level=" . $level->id, "https");
            ?>
"><?php 
            _e('Sign Up', 'pmpro');
            ?>
</a>
                        <?php 
        } elseif (!$current_level) {
            ?>
     
                            <!--
                            <a class="pmpro_btn pmpro_btn-select" href="<?php 
            //echo pmpro_url("checkout", "?level=" . $level->id, "https")
            ?>
"><?php 
            //_e('Change Subscription', 'pmpro');
            ?>
</a>
                            -->
                            <a class="pmpro_btn pmpro_btn-select change-subscription" href="<?php 
            echo "/billing/subscription-checkout?level=" . $level->id;
            ?>
"><?php 
            _e('Change Subscription', 'pmpro');
            ?>
</a>
                        <?php 
        } elseif ($current_level) {
            ?>
      
                            <?php 
            //if it's a one-time-payment level, offer a link to renew
            if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                ?>
                                <a class="pmpro_btn pmpro_btn-select renew" href="<?php 
                echo pmpro_url("checkout", "?level=" . $level->id, "https");
                ?>
"><?php 
                _e('Renew', 'pmpro');
                ?>
</a>
                                <?php 
            } else {
                ?>
                                <a class="pmpro_btn disabled your-current-level" href="<?php 
                echo pmpro_url("account");
                ?>
"><?php 
                _e('Your&nbsp;Current&nbsp;Level', 'pmpro');
                ?>
</a>
                                <?php 
            }
            ?>
                        <?php 
        }
        ?>
                    </div>
                </div>
                <?php 
    }
    ?>
            <div class="clear clearfix"></div>
            <nav id="nav-below" class="navigation" role="navigation">
                <div class="nav-previous alignleft">
                    <?php 
    if (!empty($current_user->membership_level->ID)) {
        ?>
                        <!--
                            <a href="<?php 
        echo pmpro_url("account");
        ?>
"><?php 
        _e('&larr; Return to Your Account', 'pmpro');
        ?>
</a>
                        -->
                    <?php 
    } else {
        ?>
                        <a href="<?php 
        echo home_url();
        ?>
"><?php 
        _e('&larr; Return to Home', 'pmpro');
        ?>
</a>
                    <?php 
    }
    ?>
                </div>
            </nav>
        </div>
    </div>    

    <?php 
}
Exemple #6
0
	<tbody>                
		<tr>
			<td>				
				<p>You have selected the <strong><?php echo $pmpro_level->name?></strong> membership level.</p>
				
				<?php
					if(!empty($pmpro_level->description))
						echo apply_filters("the_content", stripslashes($pmpro_level->description));
				?>
				
				<p id="pmpro_level_cost">
					<?php if($discount_code && pmpro_checkDiscountCode($discount_code)) { ?>
						The <strong><?php echo $discount_code?></strong> code has been applied to your order.
					<?php } ?>
					<?php echo pmpro_getLevelCost($pmpro_level)?>
					<?php echo pmpro_getLevelExpiration($pmpro_level)?>
				</p>
				
				<?php do_action("pmpro_checkout_after_level_cost"); ?>				
				
				<?php if($pmpro_show_discount_code) { ?>
				
					<?php if($discount_code && !$pmpro_review) { ?>
						<p id="other_discount_code_p" class="pmpro_small"><a id="other_discount_code_a" href="#discount_code">Click here to change your discount code</a>.</p>
					<?php } elseif(!$pmpro_review) { ?>
						<p id="other_discount_code_p" class="pmpro_small">Do you have a discount code? <a id="other_discount_code_a" href="#discount_code">Click here to enter your discount code</a>.</p>
					<?php } elseif($pmpro_review && $discount_code) { ?>
						<p><strong>Discount Code:</strong> <?php echo $discount_code?></p>
					<?php } ?>
				
				<?php } ?>