Paid Memberships Pro - Version 2.5.10.2

Version Description

  • 2021-08-02 =
  • ENHANCEMENT: New scripts to use WP CLI to update pot and po/mo files.
  • BUG FIX/ENHANCEMENT: Updated cancellation logic to support upcoming Cancel on Next Payment Date Add On changes.
  • BUG FIX/ENHANCEMENT: Making sure to use the correct security setting when calling setcookie from an HTTPS site. (Thanks, freax on GitHub)
  • BUG FIX: Now archiving Stripe products after checkout. We create a unique product for each checkout, and these would clutter up the Stripe reports.
  • BUG FIX: Fixing data erasure and data export request action for login page.
  • BUG FIX: Fixed issue where PMPro settings on Elementor elements could override the "should_render" setting incorrectly. (Thanks, codezz on GitHub)
  • BUG FIX: Now catching the case where you try to email an invoice for an order that has no user.
Download this release

Release Info

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

Code changes from version 2.5.10.1 to 2.5.10.2

CHANGELOG.txt CHANGED
@@ -1,4 +1,13 @@
1
  == Changelog ==
 
 
 
 
 
 
 
 
 
2
  = 2.5.10.1 - 2021-07-05 =
3
  * BUG FIX/ENHANCEMENT: The 'Edit Code: %s' string on the discount codes page is now wrapped for translation.
4
  * BUG FIX: Fixed issue with the getfile.php script introduced in 2.5.10.
1
  == Changelog ==
2
+ = 2.5.10.2 - 2021-08-02 =
3
+ * ENHANCEMENT: New scripts to use WP CLI to update pot and po/mo files.
4
+ * BUG FIX/ENHANCEMENT: Updated cancellation logic to support upcoming Cancel on Next Payment Date Add On changes.
5
+ * BUG FIX/ENHANCEMENT: Making sure to use the correct security setting when calling setcookie from an HTTPS site. (Thanks, freax on GitHub)
6
+ * BUG FIX: Now archiving Stripe products after checkout. We create a unique product for each checkout, and these would clutter up the Stripe reports.
7
+ * BUG FIX: Fixing data erasure and data export request action for login page.
8
+ * BUG FIX: Fixed issue where PMPro settings on Elementor elements could override the "should_render" setting incorrectly. (Thanks, codezz on GitHub)
9
+ * BUG FIX: Now catching the case where you try to email an invoice for an order that has no user.
10
+
11
  = 2.5.10.1 - 2021-07-05 =
12
  * BUG FIX/ENHANCEMENT: The 'Edit Code: %s' string on the discount codes page is now wrapped for translation.
13
  * BUG FIX: Fixed issue with the getfile.php script introduced in 2.5.10.
adminpages/functions.php CHANGED
@@ -389,7 +389,7 @@ function pmpro_add_email_order_modal() {
389
  $email = new PMProEmail();
390
  $user = get_user_by( 'email', sanitize_email( $_REQUEST['email'] ) );
391
  $order = new MemberOrder( $_REQUEST['order'] );
392
- if ( $email->sendBillableInvoiceEmail( $user, $order ) ) { ?>
393
  <div class="notice notice-success is-dismissible">
394
  <p><?php _e( 'Invoice emailed successfully.', 'paid-memberships-pro' ); ?></p>
395
  </div>
389
  $email = new PMProEmail();
390
  $user = get_user_by( 'email', sanitize_email( $_REQUEST['email'] ) );
391
  $order = new MemberOrder( $_REQUEST['order'] );
392
+ if ( ! empty( $user ) && ! empty( $order ) && $email->sendBillableInvoiceEmail( $user, $order ) ) { ?>
393
  <div class="notice notice-success is-dismissible">
394
  <p><?php _e( 'Invoice emailed successfully.', 'paid-memberships-pro' ); ?></p>
395
  </div>
adminpages/reports/login.php CHANGED
@@ -412,12 +412,15 @@ function pmpro_report_track_values($type, $user_id = NULL) {
412
  return false;
413
 
414
  //check for cookie for visits
415
- if($type == "visits" && !empty($_COOKIE['pmpro_visit']))
416
  return false;
 
417
 
418
  //set cookie for visits
419
- if($type == "visits" && empty($_COOKIE['pmpro_visit']))
420
- setcookie("pmpro_visit", "1", NULL, COOKIEPATH, COOKIE_DOMAIN, false);
 
 
421
 
422
  //some vars for below
423
  $now = current_time('timestamp');
412
  return false;
413
 
414
  //check for cookie for visits
415
+ if( $type === 'visits' && !empty( $_COOKIE['pmpro_visit'] ) ) {
416
  return false;
417
+ }
418
 
419
  //set cookie for visits
420
+ if( $type === 'visits' && empty( $_COOKIE['pmpro_visit'] ) ) {
421
+ // The secure parameter is set to is_ssl(), true if HTTPS.
422
+ setcookie( 'pmpro_visit', '1', null, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true );
423
+ }
424
 
425
  //some vars for below
426
  $now = current_time('timestamp');
blocks/blocks.php CHANGED
@@ -27,8 +27,12 @@ require_once( 'login/block.php' );
27
 
28
  /**
29
  * Add PMPro block category
 
 
 
 
30
  */
31
- function pmpro_place_blocks_in_panel( $categories, $post ) {
32
  return array_merge(
33
  $categories,
34
  array(
@@ -39,7 +43,15 @@ function pmpro_place_blocks_in_panel( $categories, $post ) {
39
  )
40
  );
41
  }
42
- add_filter( 'block_categories', 'pmpro_place_blocks_in_panel', 10, 2 );
 
 
 
 
 
 
 
 
43
 
44
  /**
45
  * Enqueue block editor only JavaScript and CSS
27
 
28
  /**
29
  * Add PMPro block category
30
+ * This callback is used with the block_categories (pre 5.8)
31
+ * and block_categories_all (5.8+) filters. In the first filter,
32
+ * the second parameter is a $post, in the latter it's a $context.
33
+ * We don't use the second parameter yet though.
34
  */
35
+ function pmpro_place_blocks_in_panel( $categories, $post_or_context ) {
36
  return array_merge(
37
  $categories,
38
  array(
43
  )
44
  );
45
  }
46
+
47
+ // Use the correct filter based on WP version.
48
+ if ( function_exists( 'get_default_block_categories' ) ) {
49
+ // 5.8+, context is 2nd parameter.
50
+ add_filter( 'block_categories_all', 'pmpro_place_blocks_in_panel', 10, 2 );
51
+ } else {
52
+ // Pre-5.8, post is 2nd parameter.
53
+ add_filter( 'block_categories', 'pmpro_place_blocks_in_panel', 10, 2 );
54
+ }
55
 
56
  /**
57
  * Enqueue block editor only JavaScript and CSS
classes/gateways/class.pmprogateway_stripe.php CHANGED
@@ -3,6 +3,7 @@
3
  use Stripe\Customer as Stripe_Customer;
4
  use Stripe\Invoice as Stripe_Invoice;
5
  use Stripe\Plan as Stripe_Plan;
 
6
  use Stripe\Charge as Stripe_Charge;
7
  use Stripe\PaymentIntent as Stripe_PaymentIntent;
8
  use Stripe\SetupIntent as Stripe_SetupIntent;
@@ -2010,7 +2011,10 @@ class PMProGateway_stripe extends PMProGateway {
2010
  }
2011
 
2012
  /**
2013
- * Create a new subscription with Stripe
 
 
 
2014
  *
2015
  * @since 1.4
2016
  */
@@ -2996,6 +3000,11 @@ class PMProGateway_stripe extends PMProGateway {
2996
 
2997
  function delete_plan( &$order ) {
2998
  try {
 
 
 
 
 
2999
  $order->plan->delete();
3000
  } catch ( Stripe\Error\Base $e ) {
3001
  $order->error = $e->getMessage();
@@ -3014,6 +3023,23 @@ class PMProGateway_stripe extends PMProGateway {
3014
  return true;
3015
  }
3016
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3017
  function get_setup_intent( &$order ) {
3018
 
3019
  if ( ! empty( $order->setup_intent_id ) ) {
3
  use Stripe\Customer as Stripe_Customer;
4
  use Stripe\Invoice as Stripe_Invoice;
5
  use Stripe\Plan as Stripe_Plan;
6
+ use Stripe\Product as Stripe_Product;
7
  use Stripe\Charge as Stripe_Charge;
8
  use Stripe\PaymentIntent as Stripe_PaymentIntent;
9
  use Stripe\SetupIntent as Stripe_SetupIntent;
2011
  }
2012
 
2013
  /**
2014
+ * Create a new subscription with Stripe.
2015
+ *
2016
+ * This function is not run as a part of the PMPro Checkout Process.
2017
+ * See method create_setup_intent().
2018
  *
2019
  * @since 1.4
2020
  */
3000
 
3001
  function delete_plan( &$order ) {
3002
  try {
3003
+ // Delete the product first while we have a reference to it...
3004
+ if ( ( ! empty( $order->plan->product ) ) && ( ! $this->archive_product( $order ) ) ) {
3005
+ return false;
3006
+ }
3007
+ // Then delete the plan.
3008
  $order->plan->delete();
3009
  } catch ( Stripe\Error\Base $e ) {
3010
  $order->error = $e->getMessage();
3023
  return true;
3024
  }
3025
 
3026
+ function archive_product( &$order ) {
3027
+ try {
3028
+ $product = Stripe_Product::update( $order->plan->product, array( 'active' => false ) );
3029
+ } catch ( Stripe\Error\Base $e ) {
3030
+ $order->error = $e->getMessage();
3031
+ return false;
3032
+ } catch ( \Throwable $e ) {
3033
+ $order->error = $e->getMessage();
3034
+ return false;
3035
+ } catch ( \Exception $e ) {
3036
+ $order->error = $e->getMessage();
3037
+ return false;
3038
+ }
3039
+
3040
+ return true;
3041
+ }
3042
+
3043
  function get_setup_intent( &$order ) {
3044
 
3045
  if ( ! empty( $order->setup_intent_id ) ) {
includes/compatibility/elementor/class-pmpro-elementor-content-restriction.php CHANGED
@@ -54,9 +54,15 @@ class PMPro_Elementor_Content_Restriction extends PMPro_Elementor {
54
 
55
  // Don't hide content in editor mode.
56
  if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
57
- return $should_render;
58
- }
59
 
 
 
 
 
 
 
60
  $should_render = $this->pmpro_elementor_has_access( $element );
61
 
62
  return apply_filters( 'pmpro_elementor_section_access', $should_render, $element );
54
 
55
  // Don't hide content in editor mode.
56
  if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
57
+ return $should_render;
58
+ }
59
 
60
+ // Bypass if it's already hidden.
61
+ if ( $should_render === false ) {
62
+ return $should_render;
63
+ }
64
+
65
+ // Checks if the element is restricted and then if the user has access.
66
  $should_render = $this->pmpro_elementor_has_access( $element );
67
 
68
  return apply_filters( 'pmpro_elementor_section_access', $should_render, $element );
includes/login.php CHANGED
@@ -339,6 +339,12 @@ function pmpro_login_forms_handler( $show_menu = true, $show_logout_link = true,
339
  case 'recovered':
340
  $message = __( 'Check your email for the confirmation link.', 'paid-memberships-pro' );
341
  break;
 
 
 
 
 
 
342
  }
343
  }
344
 
@@ -438,7 +444,7 @@ function pmpro_login_forms_handler( $show_menu = true, $show_logout_link = true,
438
 
439
  // Note we don't show messages on the widget form.
440
  if ( $message && $location !== 'widget' ) {
441
- echo '<div class="' . pmpro_get_element_class( 'pmpro_message ' . $msgt, esc_attr( $msgt ) ) . '">'. esc_html( $message ) .'</div>';
442
  }
443
 
444
  // Get the form title HTML tag.
@@ -1008,4 +1014,6 @@ function pmpro_confirmaction_handler() {
1008
 
1009
  /** This action is documented in wp-login.php */
1010
  do_action( 'user_request_action_confirmed', $request_id );
 
 
1011
  }
339
  case 'recovered':
340
  $message = __( 'Check your email for the confirmation link.', 'paid-memberships-pro' );
341
  break;
342
+ case 'confirmaction':
343
+ // Check if we are processing a confirmaction for a Data Request.
344
+ $request_id = pmpro_confirmaction_handler();
345
+ $message = _wp_privacy_account_request_confirmed_message( $request_id );
346
+ $msgt = 'pmpro_success';
347
+ break;
348
  }
349
  }
350
 
444
 
445
  // Note we don't show messages on the widget form.
446
  if ( $message && $location !== 'widget' ) {
447
+ echo '<div class="' . pmpro_get_element_class( 'pmpro_message ' . $msgt, esc_attr( $msgt ) ) . '">'. wp_kses_post( $message ) .'</div>';
448
  }
449
 
450
  // Get the form title HTML tag.
1014
 
1015
  /** This action is documented in wp-login.php */
1016
  do_action( 'user_request_action_confirmed', $request_id );
1017
+
1018
+ return $request_id;
1019
  }
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.10.1
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.10.1' );
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.10.2
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.10.2' );
20
  define( 'PMPRO_USER_AGENT', 'Paid Memberships Pro v' . PMPRO_VERSION . '; ' . site_url() );
21
  define( 'PMPRO_MIN_PHP_VERSION', '5.6' );
22
 
preheaders/account.php CHANGED
@@ -10,16 +10,6 @@ if ( ! is_user_logged_in() ) {
10
  }
11
  }
12
 
13
- // Check if we are processing a confirmaction for a Data Request.
14
- $request_id = pmpro_confirmaction_handler();
15
- if ( $request_id ) {
16
- $pmpro_msg = _wp_privacy_account_request_confirmed_message( $request_id );
17
- $pmpro_msgt = 'pmpro_success';
18
- } else {
19
- $pmpro_msg = 'What?';
20
- $pmpro_msgt = 'pmpro_error';
21
- }
22
-
23
  // Make sure the membership level is set for the user.
24
  if( $current_user->ID ) {
25
  $current_user->membership_level = pmpro_getMembershipLevelForUser( $current_user->ID );
10
  }
11
  }
12
 
 
 
 
 
 
 
 
 
 
 
13
  // Make sure the membership level is set for the user.
14
  if( $current_user->ID ) {
15
  $current_user->membership_level = pmpro_getMembershipLevelForUser( $current_user->ID );
preheaders/cancel.php CHANGED
@@ -63,7 +63,8 @@
63
  if(!empty($old_level_ids)) {
64
  $worked = true;
65
  foreach($old_level_ids as $old_level_id) {
66
- $worked = $worked && pmpro_cancelMembershipLevel($old_level_id, $current_user->ID, 'cancelled');
 
67
  }
68
  }
69
  else {
@@ -71,7 +72,7 @@
71
  $worked = pmpro_changeMembershipLevel(0, $current_user->ID, 'cancelled');
72
  }
73
 
74
- if($worked === true && empty($pmpro_error))
75
  {
76
  $pmpro_msg = __("Your membership has been cancelled.", 'paid-memberships-pro' );
77
  $pmpro_msgt = "pmpro_success";
63
  if(!empty($old_level_ids)) {
64
  $worked = true;
65
  foreach($old_level_ids as $old_level_id) {
66
+ $one_worked = pmpro_cancelMembershipLevel($old_level_id, $current_user->ID, 'cancelled');
67
+ $worked = $worked && $one_worked !== false;
68
  }
69
  }
70
  else {
72
  $worked = pmpro_changeMembershipLevel(0, $current_user->ID, 'cancelled');
73
  }
74
 
75
+ if($worked != false && empty($pmpro_error))
76
  {
77
  $pmpro_msg = __("Your membership has been cancelled.", 'paid-memberships-pro' );
78
  $pmpro_msgt = "pmpro_success";
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.8
6
- Stable tag: 2.5.10.1
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,15 @@ 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.10.1 - 2021-07-05 =
157
  * BUG FIX/ENHANCEMENT: The 'Edit Code: %s' string on the discount codes page is now wrapped for translation.
158
  * BUG FIX: Fixed issue with the getfile.php script introduced in 2.5.10.
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.8
6
+ Stable tag: 2.5.10.2
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.10.2 - 2021-08-02 =
157
+ * ENHANCEMENT: New scripts to use WP CLI to update pot and po/mo files.
158
+ * BUG FIX/ENHANCEMENT: Updated cancellation logic to support upcoming Cancel on Next Payment Date Add On changes.
159
+ * BUG FIX/ENHANCEMENT: Making sure to use the correct security setting when calling setcookie from an HTTPS site. (Thanks, freax on GitHub)
160
+ * BUG FIX: Now archiving Stripe products after checkout. We create a unique product for each checkout, and these would clutter up the Stripe reports.
161
+ * BUG FIX: Fixing data erasure and data export request action for login page.
162
+ * BUG FIX: Fixed issue where PMPro settings on Elementor elements could override the "should_render" setting incorrectly. (Thanks, codezz on GitHub)
163
+ * BUG FIX: Now catching the case where you try to email an invoice for an order that has no user.
164
+
165
  = 2.5.10.1 - 2021-07-05 =
166
  * BUG FIX/ENHANCEMENT: The 'Edit Code: %s' string on the discount codes page is now wrapped for translation.
167
  * BUG FIX: Fixed issue with the getfile.php script introduced in 2.5.10.