Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
Now using the levels filtered order based on settings; Updating plugi…
Browse files Browse the repository at this point in the history
…n links, tested up to and readme.
  • Loading branch information
Kimberly Coleman committed Aug 7, 2019
1 parent f76de0c commit 084c3b4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 34 deletions.
14 changes: 7 additions & 7 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: strangerstudios
Tags: paid memberships pro, pmpro, memberships, ecommerce
Requires at least: 3.0
Tested up to: 4.8
Tested up to: 5.2.2
Stable tag: .3

The default PMPro Membership Levels page displays in a table layout. This plugin changes your levels page layout to use a DIV for each level. If you are using the PMPro Level Cost Text add on, it will use that text for the generated price sentence. Alternately, it will just use the automatically generated level cost text PMPro provides.
Expand All @@ -18,15 +18,15 @@ Display your Membership Levels in a DIV layout, allowing you to add custom CSS t
1. Activate the plugin through the 'Plugins' menu in WordPress.
1. That's it. No settings.

== Changelog ==
== Changelog ==
= .3 =
* Now checking which levels to display instead of displaying all levels.
* BUG FIX/ENHANCEMENT: Now checking which levels to display instead of displaying all levels.
* BUG FIX/ENHANCEMENT: Now respecting the levels order set by the Settings > Membership Levels admin page.

= .2 =
* Added meta links to plugins page.
* Fixed _e() use in some cases.
* Now showing "renew" to members with non-recurring levels with an end date instead of "your level".
* BUG FIX: Fixed _e() use in some cases.
* ENHANCEMENT: Now showing "renew" to members with non-recurring levels with an end date instead of "your level".
* ENHANCEMENT: Added meta links to plugins page.

= .1 =
* Initial release

8 changes: 4 additions & 4 deletions pmpro-div-levels.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/*
Plugin Name: Paid Memberships Pro - Levels as DIV Layout Add On
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-div-levels/
Plugin URI: https://www.paidmembershipspro.com/add-ons/levels-page-div-layout/
Description: Display your Membership Levels Page in a DIV Layout for Paid Memberships Pro
Version: .3
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
Author: Paid Memberships Pro
Author URI: https://www.paidmembershipspro.com
*/

//use our levels template
Expand All @@ -26,7 +26,7 @@ function pmprodiv_plugin_row_meta($links, $file) {
if(strpos($file, 'pmpro-div-levels.php') !== false)
{
$new_links = array(
'<a href="' . esc_url('http://www.paidmembershipspro.com/add-ons/plugins-on-github/levels-page-div-layout/') . '" title="' . esc_attr( __( 'View Documentation', 'pmpro' ) ) . '">' . __( 'Docs', 'pmpro' ) . '</a>',
'<a href="' . esc_url('https://www.paidmembershipspro.com/add-ons/levels-page-div-layout/') . '" title="' . esc_attr( __( 'View Documentation', 'pmpro' ) ) . '">' . __( 'Docs', 'pmpro' ) . '</a>',
'<a href="' . esc_url('http://paidmembershipspro.com/support/') . '" title="' . esc_attr( __( 'Visit Customer Support Forum', 'pmpro' ) ) . '">' . __( 'Support', 'pmpro' ) . '</a>',
);
$links = array_merge($links, $new_links);
Expand Down
67 changes: 44 additions & 23 deletions templates/levels.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
<?php
global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $pmpro_currency_symbol;
<?php
global $wpdb, $pmpro_msg, $pmpro_msgt, $current_user;

$pmpro_levels = pmpro_getAllLevels(false, true);
$pmpro_level_order = pmpro_getOption('level_order');

if(!empty($pmpro_level_order))
{
$order = explode(',',$pmpro_level_order);

//reorder array
$reordered_levels = array();
foreach($order as $level_id) {
foreach($pmpro_levels as $key=>$level) {
if($level_id == $level->id)
$reordered_levels[] = $pmpro_levels[$key];
}
}

$pmpro_levels = $reordered_levels;
}

$pmpro_levels = apply_filters("pmpro_levels_array", $pmpro_levels);

if($pmpro_msg)
{
?>
<div class="message <?php echo $pmpro_msgt?>"><?php echo $pmpro_msg?></div>
<div class="pmpro_message <?php echo $pmpro_msgt?>"><?php echo $pmpro_msg?></div>
<?php
}
?>

<div id="pmpro_levels">
<?php

<?php
$count = 0;
$pmpro_levels = apply_filters("pmpro_levels_array", $pmpro_levels);
foreach($pmpro_levels as $level)
Expand All @@ -22,17 +43,17 @@
?>
<div id="pmpro_level-<?php echo $level->id; ?>" class="pmpro_level<?php if($current_level == $level) { ?> pmpro_level-active<?php } ?>">
<h2><?php echo $current_level ? "<strong>{$level->name}</strong>" : $level->name?></h2>
<p class="pmpro_level-price">
<?php
if(pmpro_isLevelFree($level))
{
<p class="pmpro_level-price">
<?php
if(pmpro_isLevelFree($level))
{
?>
<strong><?php _e('Free', 'pmpro');?></strong>
<?php
<?php
echo pmpro_getLevelExpiration($level);
}
else
{
}
else
{
echo pmpro_getLevelCost($level);
$expiration_text = pmpro_getLevelExpiration($level);
if($expiration_text)
Expand All @@ -41,26 +62,26 @@
<br /><span class="pmpro_level-expiration"><?php echo $expiration_text?></span>
<?php
}
}
}
?>
</p> <!-- end pmpro_level-price -->
<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 _e('Select', '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('Select', '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('Select', '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('Select', 'pmpro');?></a>
<?php } elseif($current_level) { ?>
<?php 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 _e('Renew', 'pmpro');?></a>
<?php } else { ?>
<a class="pmpro_btn disabled"href="<?php echo pmpro_url("account")?>"><?php _e('Your&nbsp;Level', 'pmpro');?></a>
<?php } ?>
<?php } ?>
</p>
<?php
</p>
<?php
if(!empty($level->description))
echo apply_filters("the_content", stripslashes($level->description));
?>
?>
</div> <!-- end pmpro_level -->
<?php
}
Expand All @@ -74,4 +95,4 @@
<?php } ?>
</div>
</nav>
</div> <!-- end #pmpro_levels -->
</div> <!-- end #pmpro_levels -->

0 comments on commit 084c3b4

Please sign in to comment.