Paid Memberships Pro - Version 2.5.9

Version Description

  • 2021-05-05 =
  • ENHANCEMENT: Adjusting style for prices and price parts shown on the frontend.
  • ENHANCEMENT: Adjusting HTML for links in the Orders table in the dashboard.
  • BUG FIX: Reverted the change to the pmpro_is_checkout() function. Since we default to the first available level, calling pmpro_getLevelForCheckout() was causing pmpro_is_checkout to return true on ALL pages. This disrupted a lot of functionality.
  • BUG FIX: Fixed warnings in the pmpro_getLevelAtCheckout() function.
  • BUG FIX: Fixed issue where "All Time Sales" was showing up as 0, even when there were sales.
Download this release

Release Info

Developer strangerstudios
Plugin Icon 128x128 Paid Memberships Pro
Version 2.5.9
Comparing to
See all releases

Code changes from version 2.5.8 to 2.5.9

CHANGELOG.txt CHANGED
@@ -1,4 +1,11 @@
1
  == Changelog ==
 
 
 
 
 
 
 
2
  = 2.5.8 - 2021-04-30 =
3
  * ENHANCEMENT: Added `pmpro_membership_content_filter` filter to let other plugins change how PMPro filters member content.
4
  * ENHANCEMENT: Improved de_DE email template translation. (Thanks, biker238 on GitHub)
1
  == Changelog ==
2
+ = 2.5.9 - 2021-05-05 =
3
+ * ENHANCEMENT: Adjusting style for prices and price parts shown on the frontend.
4
+ * ENHANCEMENT: Adjusting HTML for links in the Orders table in the dashboard.
5
+ * BUG FIX: Reverted the change to the pmpro_is_checkout() function. Since we default to the first available level, calling pmpro_getLevelForCheckout() was causing pmpro_is_checkout to return true on ALL pages. This disrupted a lot of functionality.
6
+ * BUG FIX: Fixed warnings in the pmpro_getLevelAtCheckout() function.
7
+ * BUG FIX: Fixed issue where "All Time Sales" was showing up as 0, even when there were sales.
8
+
9
  = 2.5.8 - 2021-04-30 =
10
  * ENHANCEMENT: Added `pmpro_membership_content_filter` filter to let other plugins change how PMPro filters member content.
11
  * ENHANCEMENT: Improved de_DE email template translation. (Thanks, biker238 on GitHub)
adminpages/discountcodes.php CHANGED
@@ -6,7 +6,7 @@
6
  }
7
 
8
  //vars
9
- global $wpdb, $pmpro_currency_symbol, $pmpro_stripe_error, $pmpro_braintree_error, $pmpro_payflow_error, $pmpro_twocheckout_error;
10
 
11
  $now = current_time( 'timestamp' );
12
 
@@ -848,7 +848,11 @@
848
 
849
  $level_names = array();
850
  foreach( $levels as $level ) {
851
- $level_names[] = '<a title="' . pmpro_url( 'checkout', '?level=' . $level->id . '&discount_code=' . $code->code) . '" target="_blank" href="' . pmpro_url( 'checkout', '?level=' . $level->id . '&discount_code=' . $code->code) . '">' . $level->name . '</a>';
 
 
 
 
852
  }
853
  if( $level_names ) {
854
  echo implode( ', ', $level_names );
6
  }
7
 
8
  //vars
9
+ global $wpdb, $pmpro_currency_symbol, $pmpro_stripe_error, $pmpro_braintree_error, $pmpro_payflow_error, $pmpro_twocheckout_error, $pmpro_pages;
10
 
11
  $now = current_time( 'timestamp' );
12
 
848
 
849
  $level_names = array();
850
  foreach( $levels as $level ) {
851
+ if ( ! empty( $pmpro_pages['checkout'] ) ) {
852
+ $level_names[] = '<a title="' . pmpro_url( 'checkout', '?level=' . $level->id . '&discount_code=' . $code->code) . '" target="_blank" href="' . pmpro_url( 'checkout', '?level=' . $level->id . '&discount_code=' . $code->code) . '">' . $level->name . '</a>';
853
+ } else {
854
+ $level_names[] = $level->name;
855
+ }
856
  }
857
  if( $level_names ) {
858
  echo implode( ', ', $level_names );
adminpages/membershiplevels.php CHANGED
@@ -5,7 +5,7 @@
5
  die(__("You do not have permissions to perform this action.", 'paid-memberships-pro' ));
6
  }
7
 
8
- global $wpdb, $msg, $msgt, $pmpro_currency_symbol, $allowedposttags;
9
 
10
  //some vars
11
  $gateway = pmpro_getOption("gateway");
@@ -821,7 +821,17 @@
821
  <?php _e('After', 'paid-memberships-pro' );?> <?php echo $level->expiration_number?> <?php echo sornot($level->expiration_period,$level->expiration_number)?>
822
  <?php } ?>
823
  </td>
824
- <td><?php if($level->allow_signups) { ?><a target="_blank" href="<?php echo add_query_arg( 'level', $level->id, pmpro_url("checkout") );?>"><?php _e('Yes', 'paid-memberships-pro' );?></a><?php } else { ?><?php _e('No', 'paid-memberships-pro' );?><?php } ?></td>
 
 
 
 
 
 
 
 
 
 
825
  <?php do_action( 'pmpro_membership_levels_table_extra_cols_body', $level ); ?>
826
  </tr>
827
  <?php
5
  die(__("You do not have permissions to perform this action.", 'paid-memberships-pro' ));
6
  }
7
 
8
+ global $wpdb, $msg, $msgt, $pmpro_currency_symbol, $allowedposttags, $pmpro_pages;
9
 
10
  //some vars
11
  $gateway = pmpro_getOption("gateway");
821
  <?php _e('After', 'paid-memberships-pro' );?> <?php echo $level->expiration_number?> <?php echo sornot($level->expiration_period,$level->expiration_number)?>
822
  <?php } ?>
823
  </td>
824
+ <td><?php
825
+ if($level->allow_signups) {
826
+ if ( ! empty( $pmpro_pages['checkout'] ) ) {
827
+ ?><a target="_blank" href="<?php echo add_query_arg( 'level', $level->id, pmpro_url("checkout") );?>"><?php _e('Yes', 'paid-memberships-pro' );?></a><?php
828
+ } else {
829
+ _e('Yes', 'paid-memberships-pro' );
830
+ }
831
+ } else {
832
+ _e('No', 'paid-memberships-pro' );
833
+ }
834
+ ?></td>
835
  <?php do_action( 'pmpro_membership_levels_table_extra_cols_body', $level ); ?>
836
  </tr>
837
  <?php
adminpages/orders.php CHANGED
@@ -1387,7 +1387,8 @@ if ( function_exists( 'pmpro_add_email_order_modal' ) ) {
1387
  <td class="username column-username">
1388
  <?php $order->getUser(); ?>
1389
  <?php if ( ! empty( $order->user ) ) { ?>
1390
- <a href="user-edit.php?user_id=<?php echo esc_attr( $order->user->ID ); ?>"><?php echo esc_html( $order->user->user_login ); ?> (<?php echo esc_html( $order->user->user_email ); ?>)</a>
 
1391
  <?php } elseif ( $order->user_id > 0 ) { ?>
1392
  [<?php esc_html_e( 'deleted', 'paid-memberships-pro' ); ?>]
1393
  <?php } else { ?>
1387
  <td class="username column-username">
1388
  <?php $order->getUser(); ?>
1389
  <?php if ( ! empty( $order->user ) ) { ?>
1390
+ <a href="user-edit.php?user_id=<?php echo esc_attr( $order->user->ID ); ?>"><?php echo esc_html( $order->user->user_login ); ?></a><br />
1391
+ <?php echo esc_html( $order->user->user_email ); ?>
1392
  <?php } elseif ( $order->user_id > 0 ) { ?>
1393
  [<?php esc_html_e( 'deleted', 'paid-memberships-pro' ); ?>]
1394
  <?php } else { ?>
adminpages/reports/sales.php CHANGED
@@ -479,7 +479,7 @@ function pmpro_getSales($period, $levels = NULL)
479
  elseif($period == "this year")
480
  $startdate = date_i18n("Y", current_time('timestamp')) . "-01-01";
481
  else
482
- $startdate = "";
483
 
484
  $gateway_environment = pmpro_getOption("gateway_environment");
485
 
@@ -593,7 +593,7 @@ function pmpro_getRevenue($period, $levels = NULL)
593
  elseif($period == "this year")
594
  $startdate = date_i18n("Y", current_time('timestamp')) . "-01-01";
595
  else
596
- $startdate = "";
597
 
598
  // Convert from local to UTC.
599
  $startdate = get_gmt_from_date( $startdate );
479
  elseif($period == "this year")
480
  $startdate = date_i18n("Y", current_time('timestamp')) . "-01-01";
481
  else
482
+ $startdate = date_i18n("Y-m-d", 0);
483
 
484
  $gateway_environment = pmpro_getOption("gateway_environment");
485
 
593
  elseif($period == "this year")
594
  $startdate = date_i18n("Y", current_time('timestamp')) . "-01-01";
595
  else
596
+ $startdate = date_i18n("Y-m-d", 0);
597
 
598
  // Convert from local to UTC.
599
  $startdate = get_gmt_from_date( $startdate );
css/frontend.css CHANGED
@@ -286,9 +286,21 @@ select.pmpro_error {
286
  .pmpro_price_part_span {
287
  display: block;
288
  }
 
 
 
 
 
289
  .pmpro_price_part_label:after {
290
  content: ": ";
291
  }
 
 
 
 
 
 
 
292
 
293
  /*---------------------------------------
294
  Membership Checkout
286
  .pmpro_price_part_span {
287
  display: block;
288
  }
289
+ .pmpro_price_part-total {
290
+ border-top: 1px solid #CCC;
291
+ margin-top: 5px;
292
+ padding-top: 5px;
293
+ }
294
  .pmpro_price_part_label:after {
295
  content: ": ";
296
  }
297
+ .pmpro_price_part_sub {
298
+ font-size: 75%;
299
+ }
300
+ span.pmpro_price_part_sub:before {
301
+ content: "\2022";
302
+ padding-right: 5px;
303
+ }
304
 
305
  /*---------------------------------------
306
  Membership Checkout
includes/functions.php CHANGED
@@ -2264,6 +2264,10 @@ function pmpro_are_any_visible_levels() {
2264
 
2265
  /**
2266
  * Get level at checkout and place into $pmpro_level global.
 
 
 
 
2267
  */
2268
  function pmpro_getLevelAtCheckout( $level_id = null, $discount_code = null ) {
2269
  global $pmpro_level, $wpdb, $post;
@@ -2285,9 +2289,13 @@ function pmpro_getLevelAtCheckout( $level_id = null, $discount_code = null ) {
2285
  if ( empty( $level_id ) ) {
2286
  $all_levels = pmpro_getAllLevels( false, false );
2287
 
2288
- // Get lowest level ID.
2289
- $default_level = min( array_keys( $all_levels ) );
2290
-
 
 
 
 
2291
  $level_id = apply_filters( 'pmpro_default_level', intval( $default_level ) );
2292
 
2293
  // Bail back to levels page if level ID is empty or less than 1.
@@ -2873,17 +2881,17 @@ function pmpro_get_price_parts( $pmpro_invoice, $format = 'array' ) {
2873
  $pmpro_price = '';
2874
  if ( $format == 'span' ) {
2875
  foreach ( $pmpro_price_parts_with_total as $key => $pmpro_price_part ) {
2876
- $pmpro_price .= '<span class="' . pmpro_get_element_class( 'pmpro_price_part_span pmpro_price_part-' . $key, 'pmpro_price_part-' . $key ) . '"><span class="' . pmpro_get_element_class( 'pmpro_price_part_label' ) . '">' . esc_html( $pmpro_price_part['label'] ) . '</span> <span class="' . pmpro_get_element_class( 'pmpro_price_part_price' ) . '">' . esc_html( $pmpro_price_part['value'] ) . '</span></span>';
2877
  }
2878
  } elseif ( $format == 'list' ) {
2879
  $pmpro_price .= '<ul class="' . pmpro_get_element_class( 'pmpro_price_part_list' ) . '">';
2880
  foreach ( $pmpro_price_parts_with_total as $key => $pmpro_price_part ) {
2881
- $pmpro_price .= '<li class="' . pmpro_get_element_class( 'pmpro_price_part-' . $key, 'pmpro_price_part-' . $key ) . '"><span class="' . pmpro_get_element_class( 'pmpro_price_part_label' ) . '">' . esc_html( $pmpro_price_part['label'] ) . '</span> <span class="' . pmpro_get_element_class( 'pmpro_price_part_price' ) . '">' . esc_html( $pmpro_price_part['value'] ) . '</span></li>';
2882
  }
2883
  } else {
2884
  // Default to each line separate by breaks.
2885
  foreach ( $pmpro_price_parts_with_total as $key => $pmpro_price_part ) {
2886
- $pmpro_price .= '<span class="' . pmpro_get_element_class( 'pmpro_price_part-' . $key, 'pmpro_price_part-' . $key ) . '"><span class="' . pmpro_get_element_class( 'pmpro_price_part_label' ) . '">' . esc_html( $pmpro_price_part['label'] ) . '</span> <span class="' . pmpro_get_element_class( 'pmpro_price_part_price' ) . '">' . esc_html( $pmpro_price_part['value'] ) . '</span></span><br />';
2887
  }
2888
  }
2889
  }
@@ -3407,14 +3415,6 @@ function pmpro_is_checkout() {
3407
  $is_checkout = true;
3408
  }
3409
 
3410
- // If it's not checkout, let's try one last time to see if it is.
3411
- if ( ! $is_checkout && function_exists( 'pmpro_getLevelAtCheckout' ) ) {
3412
- $level = pmpro_getLevelAtCheckout();
3413
- if ( isset( $level->id ) ) {
3414
- $is_checkout = true;
3415
- }
3416
- }
3417
-
3418
  /**
3419
  * Filter for pmpro_is_checkout return value.
3420
  * @since 2.1
2264
 
2265
  /**
2266
  * Get level at checkout and place into $pmpro_level global.
2267
+ * If no level is passed or found in the URL parameters, global vars,
2268
+ * or in the post options, then this will return the first level found.
2269
+ * @param int $level_id (optional) Pass a level ID to force that level.
2270
+ * @param string $discount_code (optional) Pass a discount code to force that code.
2271
  */
2272
  function pmpro_getLevelAtCheckout( $level_id = null, $discount_code = null ) {
2273
  global $pmpro_level, $wpdb, $post;
2289
  if ( empty( $level_id ) ) {
2290
  $all_levels = pmpro_getAllLevels( false, false );
2291
 
2292
+ if ( ! empty( $all_levels ) ) {
2293
+ // Get lowest level ID.
2294
+ $default_level = min( array_keys( $all_levels ) );
2295
+ } else {
2296
+ $default_level = null;
2297
+ }
2298
+
2299
  $level_id = apply_filters( 'pmpro_default_level', intval( $default_level ) );
2300
 
2301
  // Bail back to levels page if level ID is empty or less than 1.
2881
  $pmpro_price = '';
2882
  if ( $format == 'span' ) {
2883
  foreach ( $pmpro_price_parts_with_total as $key => $pmpro_price_part ) {
2884
+ $pmpro_price .= '<span class="' . pmpro_get_element_class( 'pmpro_price_part_span pmpro_price_part-' . sanitize_html_class( $key ), 'pmpro_price_part-' . sanitize_html_class( $key ) ) . '"><span class="' . pmpro_get_element_class( 'pmpro_price_part_label' ) . '">' . esc_html( $pmpro_price_part['label'] ) . '</span> <span class="' . pmpro_get_element_class( 'pmpro_price_part_price' ) . '">' . esc_html( $pmpro_price_part['value'] ) . '</span></span>';
2885
  }
2886
  } elseif ( $format == 'list' ) {
2887
  $pmpro_price .= '<ul class="' . pmpro_get_element_class( 'pmpro_price_part_list' ) . '">';
2888
  foreach ( $pmpro_price_parts_with_total as $key => $pmpro_price_part ) {
2889
+ $pmpro_price .= '<li class="' . pmpro_get_element_class( 'pmpro_price_part-' . sanitize_html_class( $key ), 'pmpro_price_part-' . sanitize_html_class( $key ) ) . '"><span class="' . pmpro_get_element_class( 'pmpro_price_part_label' ) . '">' . esc_html( $pmpro_price_part['label'] ) . '</span> <span class="' . pmpro_get_element_class( 'pmpro_price_part_price' ) . '">' . esc_html( $pmpro_price_part['value'] ) . '</span></li>';
2890
  }
2891
  } else {
2892
  // Default to each line separate by breaks.
2893
  foreach ( $pmpro_price_parts_with_total as $key => $pmpro_price_part ) {
2894
+ $pmpro_price .= '<span class="' . pmpro_get_element_class( 'pmpro_price_part-' . sanitize_html_class( $key ), 'pmpro_price_part-' . sanitize_html_class( $key ) ) . '"><span class="' . pmpro_get_element_class( 'pmpro_price_part_label' ) . '">' . esc_html( $pmpro_price_part['label'] ) . '</span> <span class="' . pmpro_get_element_class( 'pmpro_price_part_price' ) . '">' . esc_html( $pmpro_price_part['value'] ) . '</span></span><br />';
2895
  }
2896
  }
2897
  }
3415
  $is_checkout = true;
3416
  }
3417
 
 
 
 
 
 
 
 
 
3418
  /**
3419
  * Filter for pmpro_is_checkout return value.
3420
  * @since 2.1
paid-memberships-pro.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Paid Memberships Pro
4
  * Plugin URI: https://www.paidmembershipspro.com
5
  * Description: The most complete member management and membership subscriptions plugin for WordPress.
6
- * Version: 2.5.8
7
  * Author: Stranger Studios
8
  * Author URI: https://www.strangerstudios.com
9
  * Text Domain: paid-memberships-pro
@@ -16,7 +16,7 @@
16
  */
17
 
18
  // version constant
19
- define( 'PMPRO_VERSION', '2.5.8' );
20
  define( 'PMPRO_USER_AGENT', 'Paid Memberships Pro v' . PMPRO_VERSION . '; ' . site_url() );
21
  define( 'PMPRO_MIN_PHP_VERSION', '5.6' );
22
 
3
  * Plugin Name: Paid Memberships Pro
4
  * Plugin URI: https://www.paidmembershipspro.com
5
  * Description: The most complete member management and membership subscriptions plugin for WordPress.
6
+ * Version: 2.5.9
7
  * Author: Stranger Studios
8
  * Author URI: https://www.strangerstudios.com
9
  * Text Domain: paid-memberships-pro
16
  */
17
 
18
  // version constant
19
+ define( 'PMPRO_VERSION', '2.5.9' );
20
  define( 'PMPRO_USER_AGENT', 'Paid Memberships Pro v' . PMPRO_VERSION . '; ' . site_url() );
21
  define( 'PMPRO_MIN_PHP_VERSION', '5.6' );
22
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: strangerstudios, kimannwall, andrewza, dlparker1005, paidmembershi
3
  Tags: memberships, members, subscriptions, ecommerce, user registration, member, membership, e-commerce, paypal, stripe, braintree, authorize.net, payflow, restrict access, restrict content, directory
4
  Requires at least: 4.7
5
  Tested up to: 5.7
6
- Stable tag: 2.5.8
7
 
8
  Get Paid with Paid Memberships Pro: The most complete member management and membership subscriptions plugin for your WordPress site.
9
 
@@ -153,6 +153,13 @@ Not sure? You can find out by doing a bit a research.
153
  9. Membership Account page, display all sections or show specific sections using shortcode attributes.
154
 
155
  == Changelog ==
 
 
 
 
 
 
 
156
  = 2.5.8 - 2021-04-30 =
157
  * ENHANCEMENT: Added `pmpro_membership_content_filter` filter to let other plugins change how PMPro filters member content.
158
  * ENHANCEMENT: Improved de_DE email template translation. (Thanks, biker238 on GitHub)
3
  Tags: memberships, members, subscriptions, ecommerce, user registration, member, membership, e-commerce, paypal, stripe, braintree, authorize.net, payflow, restrict access, restrict content, directory
4
  Requires at least: 4.7
5
  Tested up to: 5.7
6
+ Stable tag: 2.5.9
7
 
8
  Get Paid with Paid Memberships Pro: The most complete member management and membership subscriptions plugin for your WordPress site.
9
 
153
  9. Membership Account page, display all sections or show specific sections using shortcode attributes.
154
 
155
  == Changelog ==
156
+ = 2.5.9 - 2021-05-05 =
157
+ * ENHANCEMENT: Adjusting style for prices and price parts shown on the frontend.
158
+ * ENHANCEMENT: Adjusting HTML for links in the Orders table in the dashboard.
159
+ * BUG FIX: Reverted the change to the pmpro_is_checkout() function. Since we default to the first available level, calling pmpro_getLevelForCheckout() was causing pmpro_is_checkout to return true on ALL pages. This disrupted a lot of functionality.
160
+ * BUG FIX: Fixed warnings in the pmpro_getLevelAtCheckout() function.
161
+ * BUG FIX: Fixed issue where "All Time Sales" was showing up as 0, even when there were sales.
162
+
163
  = 2.5.8 - 2021-04-30 =
164
  * ENHANCEMENT: Added `pmpro_membership_content_filter` filter to let other plugins change how PMPro filters member content.
165
  * ENHANCEMENT: Improved de_DE email template translation. (Thanks, biker238 on GitHub)