Paid Memberships Pro - Version 1.7.8.2

Version Description

  • Updated the Stripe API library to version 1.11.0.
  • Fixed issues where users upgrading or downgrading would have their subscriptions cancelled at Stripe.
  • Fixed issues where extra emails were being sent out when users cancelled a membership when using Stripe.
  • Generally made the Stripe integration better and ready for version 2.0.
  • The Stripe webhook will now add a 5 second delay before processing most requests. This is to ensure that PMPro has time to update the order during checkout (Stripe can sometimes receive a charge or cancellation, then send the webhook, and WP can process that in the split second it takes PMPro to save an order during checkout.). This prevents duplicate orders in the PMPro DB on some charges and fixes some issues with cancellations.
  • Setting constant PMPRO_STRIPE_WEBHOOK_DEBUG to true will send an email to the WP admin every time the Stripe Webhook is hit. You can also set it to an alternative email address or "log" to have it added to ../paid-memberships-pro/logs/stripe-webhook.txt.
  • Setting constant PMPRO_IPN_DEBUG to true will send an email to the WP admin every time the IPN handler is hit. You can also set it to an alternative email address or "log" to have it added to ../paid-memberships-pro/logs/ipn.txt.
  • Now showing the PMPro order ID/code in INVOICE emails instead of the Stripe order id when using the Stripe gateway.
Download this release

Release Info

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

Code changes from version 1.7.14 to 1.7.8.2

Files changed (115) hide show
  1. adminpages/addons.php +1 -1
  2. adminpages/addons/pmpro-addon-packages.php +1 -1
  3. adminpages/addons/pmpro-bbpress.php +1 -1
  4. adminpages/addons/pmpro-email-templates.php +1 -1
  5. adminpages/addons/pmpro-expiration.php +2 -2
  6. adminpages/addons/pmpro-infusionsoft.php +1 -1
  7. adminpages/addons/pmpro-mailchimp.php +1 -1
  8. adminpages/addons/pmpro-network-subsite.php +1 -1
  9. adminpages/addons/pmpro-post-affiliate-pro.php +1 -1
  10. adminpages/addons/pmpro-register-helper.php +1 -1
  11. adminpages/addons/pmpro-series.php +1 -1
  12. adminpages/addons/pmpro-shipping.php +1 -1
  13. adminpages/addons/pmpro-woocommerce.php +1 -1
  14. adminpages/addons/tml.php +1 -1
  15. adminpages/admin_header.php +1 -1
  16. adminpages/advancedsettings.php +5 -18
  17. adminpages/discountcodes.php +6 -6
  18. adminpages/memberslist-csv.php +2 -2
  19. adminpages/memberslist.php +3 -3
  20. adminpages/orders-csv.php +8 -8
  21. adminpages/orders.php +11 -11
  22. adminpages/pagesettings.php +8 -8
  23. adminpages/reports/login.php +1 -1
  24. adminpages/reports/memberships.php +1 -1
  25. classes/class.memberorder.php +5 -27
  26. classes/class.pmproemail.php +13 -16
  27. classes/gateways/class.pmprogateway.php +2 -18
  28. classes/gateways/class.pmprogateway_authorizenet.php +2 -2
  29. classes/gateways/class.pmprogateway_braintree.php +2 -2
  30. classes/gateways/class.pmprogateway_check.php +2 -2
  31. classes/gateways/class.pmprogateway_cybersource.php +5 -5
  32. classes/gateways/class.pmprogateway_payflowpro.php +11 -14
  33. classes/gateways/class.pmprogateway_paypal.php +10 -12
  34. classes/gateways/class.pmprogateway_paypalexpress.php +11 -42
  35. classes/gateways/class.pmprogateway_paypalstandard.php +14 -30
  36. classes/gateways/class.pmprogateway_stripe.php +16 -22
  37. css/frontend.css +0 -2
  38. email/checkout_check.html +1 -1
  39. includes/adminpages.php +66 -147
  40. includes/content.php +41 -68
  41. includes/email.php +9 -11
  42. includes/filters.php +2 -2
  43. includes/functions.php +104 -133
  44. includes/init.php +1 -30
  45. includes/login.php +2 -18
  46. includes/metaboxes.php +2 -2
  47. includes/profile.php +4 -4
  48. includes/services.php +1 -1
  49. includes/upgradecheck.php +1 -22
  50. languages/email/da_DK/admin_change.html +0 -7
  51. languages/email/da_DK/admin_change_admin.html +0 -5
  52. languages/email/da_DK/billing.html +0 -16
  53. languages/email/da_DK/billing_admin.html +0 -17
  54. languages/email/da_DK/billing_failure.html +0 -11
  55. languages/email/da_DK/billing_failure_admin.html +0 -11
  56. languages/email/da_DK/cancel.html +0 -3
  57. languages/email/da_DK/cancel_admin.html +0 -8
  58. languages/email/da_DK/checkout_check.html +0 -17
  59. languages/email/da_DK/checkout_check_admin.html +0 -17
  60. languages/email/da_DK/checkout_express.html +0 -14
  61. languages/email/da_DK/checkout_express_admin.html +0 -14
  62. languages/email/da_DK/checkout_free.html +0 -8
  63. languages/email/da_DK/checkout_free_admin.html +0 -8
  64. languages/email/da_DK/checkout_freetrial.html +0 -19
  65. languages/email/da_DK/checkout_freetrial_admin.html +0 -19
  66. languages/email/da_DK/checkout_paid.html +0 -23
  67. languages/email/da_DK/checkout_paid_admin.html +0 -23
  68. languages/email/da_DK/checkout_trial.html +0 -23
  69. languages/email/da_DK/checkout_trial_admin.html +0 -23
  70. languages/email/da_DK/credit_card_expiring.html +0 -13
  71. languages/email/da_DK/default.html +0 -1
  72. languages/email/da_DK/footer.html +0 -4
  73. languages/email/da_DK/header.html +0 -1
  74. languages/email/da_DK/invoice.html +0 -19
  75. languages/email/da_DK/membership_expired.html +0 -7
  76. languages/email/da_DK/membership_expiring.html +0 -6
  77. languages/email/da_DK/trial_ending.html +0 -8
  78. languages/pmpro-cs_CZ.mo +0 -0
  79. languages/pmpro-cs_CZ.po +0 -2889
  80. languages/pmpro-da_DK.mo +0 -0
  81. languages/pmpro-da_DK.po +0 -3502
  82. languages/pmpro-fr_FR.mo +0 -0
  83. languages/pmpro-fr_FR.po +3 -4
  84. languages/pmpro-it_IT.mo +0 -0
  85. languages/pmpro-it_IT.po +100 -227
  86. languages/pmpro-nb_NO.mo +0 -0
  87. languages/pmpro-nb_NO.po +0 -3279
  88. languages/pmpro-sk_SK.mo +0 -0
  89. languages/pmpro-sk_SK.po +0 -3826
  90. languages/pmpro-tr_TR.mo +0 -0
  91. languages/pmpro-tr_TR.po +0 -3470
  92. languages/pmpro.mo +0 -0
  93. languages/pmpro.po +288 -446
  94. languages/pmpro.pot +288 -446
  95. pages/account.php +2 -2
  96. pages/billing.php +2 -2
  97. pages/checkout.php +10 -14
  98. pages/confirmation.php +3 -3
  99. pages/invoice.php +2 -2
  100. pages/levels.php +5 -5
  101. paid-memberships-pro.php +9 -52
  102. preheaders/account.php +42 -37
  103. preheaders/billing.php +400 -372
  104. preheaders/cancel.php +40 -39
  105. preheaders/checkout.php +1090 -999
  106. preheaders/confirmation.php +12 -15
  107. preheaders/invoice.php +32 -32
  108. preheaders/levels.php +33 -32
  109. readme.txt +2 -69
  110. scheduled/crons.php +3 -3
  111. services/applydiscountcode.php +2 -8
  112. services/getfile.php +57 -5
  113. services/ipnhandler.php +16 -24
  114. services/twocheckout-ins.php +8 -12
  115. shortcodes/membership.php +2 -2
adminpages/addons.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  //only admins can get this
3
- if(!function_exists("current_user_can") || (!current_user_can("manage_options") && !current_user_can("pmpro_addons")))
4
  {
5
  die(__("You do not have permissions to perform this action.", "pmpro"));
6
  }
1
  <?php
2
  //only admins can get this
3
+ if(!function_exists("current_user_can") || !current_user_can("manage_options"))
4
  {
5
  die(__("You do not have permissions to perform this action.", "pmpro"));
6
  }
adminpages/addons/pmpro-addon-packages.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Addon Packages',
8
- 'version' => '.4.3',
9
  'widget' => 'pmpro_addon_pmpro_addon_packages_widget',
10
  'enabled' => function_exists('pmproap_post_meta')
11
  )
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Addon Packages',
8
+ 'version' => '.4.2',
9
  'widget' => 'pmpro_addon_pmpro_addon_packages_widget',
10
  'enabled' => function_exists('pmproap_post_meta')
11
  )
adminpages/addons/pmpro-bbpress.php CHANGED
@@ -7,7 +7,7 @@ pmpro_add_addon('repo', array(
7
  'title' => 'PMPro bbPress',
8
  'version' => '1.0.1',
9
  'widget' => 'pmpro_addon_pmpro_bbpress_widget',
10
- 'enabled' => function_exists('pmprobbp_add_meta_box')
11
  )
12
  );
13
 
7
  'title' => 'PMPro bbPress',
8
  'version' => '1.0.1',
9
  'widget' => 'pmpro_addon_pmpro_bbpress_widget',
10
+ 'enabled' => function_exists('pmpro_check_forum')
11
  )
12
  );
13
 
adminpages/addons/pmpro-email-templates.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('repo', array(
7
  'title' => 'PMPro Email Templates',
8
- 'version' => '.5.2',
9
  'widget' => 'pmpro_addon_email_templates_widget',
10
  'enabled' => function_exists('pmproet_scripts')
11
  )
5
  */
6
  pmpro_add_addon('repo', array(
7
  'title' => 'PMPro Email Templates',
8
+ 'version' => '.3',
9
  'widget' => 'pmpro_addon_email_templates_widget',
10
  'enabled' => function_exists('pmproet_scripts')
11
  )
adminpages/addons/pmpro-expiration.php CHANGED
@@ -5,9 +5,9 @@
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Set Expiration Dates',
8
- 'version' => '.1.1',
9
  'widget' => 'pmpro_addon_pmpro_expiration_widget',
10
- 'enabled' => function_exists('pmprosed_pmpro_checkout_level')
11
  )
12
  );
13
 
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Set Expiration Dates',
8
+ 'version' => '.1',
9
  'widget' => 'pmpro_addon_pmpro_expiration_widget',
10
+ 'enabled' => function_exists('my_pmpro_checkout_level_specific_expiration')
11
  )
12
  );
13
 
adminpages/addons/pmpro-infusionsoft.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('thirdparty', array(
7
  'title' => 'PMPro Infusionsoft Integration',
8
- 'version' => '1.2',
9
  'widget' => 'pmpro_addon_pmpro_infusionsoft_widget',
10
  'enabled' => function_exists('pmprois_init')
11
  )
5
  */
6
  pmpro_add_addon('thirdparty', array(
7
  'title' => 'PMPro Infusionsoft Integration',
8
+ 'version' => '1.0',
9
  'widget' => 'pmpro_addon_pmpro_infusionsoft_widget',
10
  'enabled' => function_exists('pmprois_init')
11
  )
adminpages/addons/pmpro-mailchimp.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('thirdparty', array(
7
  'title' => 'PMPro MailChimp Integration',
8
- 'version' => '1.0',
9
  'widget' => 'pmpro_addon_pmpro_mailchimp_widget',
10
  'enabled' => function_exists('pmpromc_init')
11
  )
5
  */
6
  pmpro_add_addon('thirdparty', array(
7
  'title' => 'PMPro MailChimp Integration',
8
+ 'version' => '.3.4',
9
  'widget' => 'pmpro_addon_pmpro_mailchimp_widget',
10
  'enabled' => function_exists('pmpromc_init')
11
  )
adminpages/addons/pmpro-network-subsite.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Network Subsite Helper',
8
- 'version' => '.2',
9
  'widget' => 'pmpro_addon_pmpro_network_subsite_widget',
10
  'enabled' => function_exists('pmpron_subsite_activated_plugin')
11
  )
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Network Subsite Helper',
8
+ 'version' => '.1',
9
  'widget' => 'pmpro_addon_pmpro_network_subsite_widget',
10
  'enabled' => function_exists('pmpron_subsite_activated_plugin')
11
  )
adminpages/addons/pmpro-post-affiliate-pro.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('thirdparty', array(
7
  'title' => 'PMPro Post Affiliate Pro Integration',
8
- 'version' => '.2.1.1',
9
  'widget' => 'pmpro_addon_pmpro_post_affiliate_pro_widget',
10
  'enabled' => function_exists('pap_pmpro_track_sale')
11
  )
5
  */
6
  pmpro_add_addon('thirdparty', array(
7
  'title' => 'PMPro Post Affiliate Pro Integration',
8
+ 'version' => '.2',
9
  'widget' => 'pmpro_addon_pmpro_post_affiliate_pro_widget',
10
  'enabled' => function_exists('pap_pmpro_track_sale')
11
  )
adminpages/addons/pmpro-register-helper.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Register Helper',
8
- 'version' => '.5.16.1',
9
  'widget' => 'pmpro_addon_pmpro_register_helper_widget',
10
  'enabled' => class_exists('PMProRH_Field')
11
  )
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Register Helper',
8
+ 'version' => '.5.11',
9
  'widget' => 'pmpro_addon_pmpro_register_helper_widget',
10
  'enabled' => class_exists('PMProRH_Field')
11
  )
adminpages/addons/pmpro-series.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Series',
8
- 'version' => '.3',
9
  'widget' => 'pmpro_addon_pmpro_series_widget',
10
  'enabled' => class_exists("PMProSeries")
11
  )
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Series',
8
+ 'version' => '.2.1',
9
  'widget' => 'pmpro_addon_pmpro_series_widget',
10
  'enabled' => class_exists("PMProSeries")
11
  )
adminpages/addons/pmpro-shipping.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Shipping Add On',
8
- 'version' => '.2.6',
9
  'widget' => 'pmpro_addon_pmpro_shipping_widget',
10
  'enabled' => function_exists('pmproship_pmpro_checkout_boxes')
11
  )
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Shipping Add On',
8
+ 'version' => '.2.4',
9
  'widget' => 'pmpro_addon_pmpro_shipping_widget',
10
  'enabled' => function_exists('pmproship_pmpro_checkout_boxes')
11
  )
adminpages/addons/pmpro-woocommerce.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('thirdparty', array(
7
  'title' => 'PMPro WooCommerce',
8
- 'version' => '1.2.2',
9
  'widget' => 'pmpro_addon_pmpro_woocommerce_widget',
10
  'enabled' => function_exists('pmprowoo_add_membership_from_order')
11
  )
5
  */
6
  pmpro_add_addon('thirdparty', array(
7
  'title' => 'PMPro WooCommerce',
8
+ 'version' => '1.1',
9
  'widget' => 'pmpro_addon_pmpro_woocommerce_widget',
10
  'enabled' => function_exists('pmprowoo_add_membership_from_order')
11
  )
adminpages/addons/tml.php CHANGED
@@ -7,7 +7,7 @@ pmpro_add_addon('recommended', array(
7
  'title' => 'Theme My Login',
8
  'widget' => 'pmpro_addon_tml_widget',
9
  'enabled' => class_exists('Theme_My_Login'),
10
- 'version' => '6.3.10'
11
  )
12
  );
13
 
7
  'title' => 'Theme My Login',
8
  'widget' => 'pmpro_addon_tml_widget',
9
  'enabled' => class_exists('Theme_My_Login'),
10
+ 'version' => '6.3.9'
11
  )
12
  );
13
 
adminpages/admin_header.php CHANGED
@@ -124,7 +124,7 @@
124
  <div class="wrap pmpro_admin">
125
  <div class="pmpro_banner">
126
  <a class="pmpro_logo" title="Paid Memberships Pro - Membership Plugin for WordPress" target="_blank" href="<?php echo pmpro_https_filter("http://www.paidmembershipspro.com")?>"><img src="<?php echo PMPRO_URL?>/images/Paid-Memberships-Pro.png" width="350" height="75" border="0" alt="Paid Memberships Pro(c) - All Rights Reserved" /></a>
127
- <div class="pmpro_meta"><span class="pmpro_tag-grey">v<?php echo PMPRO_VERSION?></span><a target="_blank" class="pmpro_tag-blue" href="<?php echo pmpro_https_filter("http://www.paidmembershipspro.com")?>"><?php _e('Plugin Support', 'pmpro');?></a><a target="_blank" class="pmpro_tag-blue" href="http://www.paidmembershipspro.com/forums/"><?php _e('User Forum', 'pmpro');?></a></div>
128
 
129
  <br style="clear:both;" />
130
  </div>
124
  <div class="wrap pmpro_admin">
125
  <div class="pmpro_banner">
126
  <a class="pmpro_logo" title="Paid Memberships Pro - Membership Plugin for WordPress" target="_blank" href="<?php echo pmpro_https_filter("http://www.paidmembershipspro.com")?>"><img src="<?php echo PMPRO_URL?>/images/Paid-Memberships-Pro.png" width="350" height="75" border="0" alt="Paid Memberships Pro(c) - All Rights Reserved" /></a>
127
+ <div class="pmpro_meta"><span class="pmpro_tag-grey">v<?php echo PMPRO_VERSION?></span><a class="pmpro_tag-blue" href="<?php echo pmpro_https_filter("http://www.paidmembershipspro.com")?>"><?php _e('Plugin Support', 'pmpro');?></a><a class="pmpro_tag-blue" href="http://www.paidmembershipspro.com/forums/"><?php _e('User Forum', 'pmpro');?></a></div>
128
 
129
  <br style="clear:both;" />
130
  </div>
adminpages/advancedsettings.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  //only admins can get this
3
- if(!function_exists("current_user_can") || (!current_user_can("manage_options") && !current_user_can("pmpro_advancedsettings")))
4
  {
5
  die(__("You do not have permissions to perform this action.", "pmpro"));
6
  }
@@ -14,7 +14,6 @@
14
  pmpro_setOption("nonmembertext");
15
  pmpro_setOption("notloggedintext");
16
  pmpro_setOption("rsstext");
17
- pmpro_setOption("filterqueries");
18
  pmpro_setOption("showexcerpts");
19
  pmpro_setOption("hideads");
20
  pmpro_setOption("hideadslevels");
@@ -47,7 +46,6 @@
47
  $notloggedintext = pmpro_getOption("notloggedintext");
48
  $rsstext = pmpro_getOption("rsstext");
49
  $hideads = pmpro_getOption("hideads");
50
- $filterqueries = pmpro_getOption('filterqueries');
51
  $showexcerpts = pmpro_getOption("showexcerpts");
52
  $hideadslevels = pmpro_getOption("hideadslevels");
53
 
@@ -119,27 +117,16 @@
119
 
120
  <tr>
121
  <th scope="row" valign="top">
122
- <label for="filterqueries"><?php _e("Filter searches and archives?", 'pmpro');?></label>
123
  </th>
124
  <td>
125
- <select id="filterqueries" name="filterqueries">
126
- <option value="0" <?php if(!$filterqueries) { ?>selected="selected"<?php } ?>><?php _e('No - Non-members will see restricted posts/pages in searches and archives.', 'pmpro');?></option>
127
- <option value="1" <?php if($filterqueries == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes - Only members will see restricted posts/pages in searches and archives.', 'pmpro');?></option>
128
  </select>
129
  </td>
130
  </tr>
131
  <tr>
132
- <th scope="row" valign="top">
133
- <label for="showexcerpts"><?php _e('Show Excerpts to Non-Members?', 'pmpro');?></label>
134
- </th>
135
- <td>
136
- <select id="showexcerpts" name="showexcerpts">
137
- <option value="0" <?php if(!$showexcerpts) { ?>selected="selected"<?php } ?>><?php _e('No - Hide excerpts.', 'pmpro');?></option>
138
- <option value="1" <?php if($showexcerpts == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes - Show excerpts.', 'pmpro');?></option>
139
- </select>
140
- </td>
141
- </tr>
142
- <tr>
143
  <th scope="row" valign="top">
144
  <label for="hideads">Hide Ads From Members?</label>
145
  </th>
1
  <?php
2
  //only admins can get this
3
+ if(!function_exists("current_user_can") || !current_user_can("manage_options"))
4
  {
5
  die(__("You do not have permissions to perform this action.", "pmpro"));
6
  }
14
  pmpro_setOption("nonmembertext");
15
  pmpro_setOption("notloggedintext");
16
  pmpro_setOption("rsstext");
 
17
  pmpro_setOption("showexcerpts");
18
  pmpro_setOption("hideads");
19
  pmpro_setOption("hideadslevels");
46
  $notloggedintext = pmpro_getOption("notloggedintext");
47
  $rsstext = pmpro_getOption("rsstext");
48
  $hideads = pmpro_getOption("hideads");
 
49
  $showexcerpts = pmpro_getOption("showexcerpts");
50
  $hideadslevels = pmpro_getOption("hideadslevels");
51
 
117
 
118
  <tr>
119
  <th scope="row" valign="top">
120
+ <label for="showexcerpts"><?php _e('Show Excerpts to Non-Members?', 'pmpro');?></label>
121
  </th>
122
  <td>
123
+ <select id="showexcerpts" name="showexcerpts">
124
+ <option value="0" <?php if(!$showexcerpts) { ?>selected="selected"<?php } ?>><?php _e('No - Hide excerpts.', 'pmpro');?></option>
125
+ <option value="1" <?php if($showexcerpts == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes - Show excerpts.', 'pmpro');?></option>
126
  </select>
127
  </td>
128
  </tr>
129
  <tr>
 
 
 
 
 
 
 
 
 
 
 
130
  <th scope="row" valign="top">
131
  <label for="hideads">Hide Ads From Members?</label>
132
  </th>
adminpages/discountcodes.php CHANGED
@@ -36,8 +36,8 @@
36
  $uses = $_POST['uses'];
37
 
38
  //fix up dates
39
- $starts = date("Y-m-d", strtotime($starts_month . "/" . $starts_day . "/" . $starts_year, current_time("timestamp")));
40
- $expires = date("Y-m-d", strtotime($expires_month . "/" . $expires_day . "/" . $expires_year, current_time("timestamp")));
41
 
42
  //updating or new?
43
  if($saveid > 0)
@@ -356,7 +356,7 @@
356
  for($i = 1; $i < 13; $i++)
357
  {
358
  ?>
359
- <option value="<?php echo $i?>" <?php if($i == $selected_starts_month) { ?>selected="selected"<?php } ?>><?php echo date("M", strtotime($i . "/1/" . $current_year, current_time("timestamp")))?></option>
360
  <?php
361
  }
362
  ?>
@@ -374,7 +374,7 @@
374
  for($i = 1; $i < 13; $i++)
375
  {
376
  ?>
377
- <option value="<?php echo $i?>" <?php if($i == $selected_expires_month) { ?>selected="selected"<?php } ?>><?php echo date("M", strtotime($i . "/1/" . $current_year, current_time("timestamp")))?></option>
378
  <?php
379
  }
380
  ?>
@@ -385,7 +385,7 @@
385
  </tr>
386
 
387
  <tr>
388
- <th scope="row" valign="top"><label for="uses"><?php _e('Uses', 'pmpro');?>:</label></th>
389
  <td>
390
  <input name="uses" type="text" size="10" value="<?php if(!empty($code->uses)) echo str_replace("\"", "&quot;", stripslashes($code->uses));?>" />
391
  <small class="pmpro_lite"><?php _e('Leave blank for unlimited uses.', 'pmpro');?></small>
@@ -397,7 +397,7 @@
397
 
398
  <?php do_action("pmpro_discount_code_after_settings"); ?>
399
 
400
- <h3><?php _e('Which Levels Will This Code Apply To?', 'pmpro'); ?></h3>
401
 
402
  <div class="pmpro_discount_levels">
403
  <?php
36
  $uses = $_POST['uses'];
37
 
38
  //fix up dates
39
+ $starts = date("Y-m-d", strtotime($starts_month . "/" . $starts_day . "/" . $starts_year));
40
+ $expires = date("Y-m-d", strtotime($expires_month . "/" . $expires_day . "/" . $expires_year));
41
 
42
  //updating or new?
43
  if($saveid > 0)
356
  for($i = 1; $i < 13; $i++)
357
  {
358
  ?>
359
+ <option value="<?php echo $i?>" <?php if($i == $selected_starts_month) { ?>selected="selected"<?php } ?>><?php echo date("M", strtotime($i . "/1/" . $current_year))?></option>
360
  <?php
361
  }
362
  ?>
374
  for($i = 1; $i < 13; $i++)
375
  {
376
  ?>
377
+ <option value="<?php echo $i?>" <?php if($i == $selected_expires_month) { ?>selected="selected"<?php } ?>><?php echo date("M", strtotime($i . "/1/" . $current_year))?></option>
378
  <?php
379
  }
380
  ?>
385
  </tr>
386
 
387
  <tr>
388
+ <th scope="row" valign="top"><label for="uses"><?php _ex('Uses', 'Number of uses for a discount code', 'pmpro');?>:</label></th>
389
  <td>
390
  <input name="uses" type="text" size="10" value="<?php if(!empty($code->uses)) echo str_replace("\"", "&quot;", stripslashes($code->uses));?>" />
391
  <small class="pmpro_lite"><?php _e('Leave blank for unlimited uses.', 'pmpro');?></small>
397
 
398
  <?php do_action("pmpro_discount_code_after_settings"); ?>
399
 
400
+ <h3>Which Levels Will This Code Apply To?</h3>
401
 
402
  <div class="pmpro_discount_levels">
403
  <?php
adminpages/memberslist-csv.php CHANGED
@@ -207,9 +207,9 @@
207
  if($theuser->membership_id)
208
  {
209
  if($theuser->enddate)
210
- $csvoutput .= pmpro_enclose(apply_filters("pmpro_memberslist_expires_column", date("Y-m-d", $theuser->enddate), $theuser));
211
  else
212
- $csvoutput .= pmpro_enclose(apply_filters("pmpro_memberslist_expires_column", "Never", $theuser));
213
  }
214
  elseif($l == "oldmembers" && $theuser->enddate)
215
  {
207
  if($theuser->membership_id)
208
  {
209
  if($theuser->enddate)
210
+ $csvoutput .= pmpro_enclose(date("Y-m-d", $theuser->enddate));
211
  else
212
+ $csvoutput .= pmpro_enclose("Never");
213
  }
214
  elseif($l == "oldmembers" && $theuser->enddate)
215
  {
adminpages/memberslist.php CHANGED
@@ -203,13 +203,13 @@
203
  -
204
  <?php } ?>
205
  </td>
206
- <td><?php echo date(get_option("date_format"), strtotime($theuser->user_registered, current_time("timestamp")))?></td>
207
  <td>
208
  <?php
209
  if($auser->enddate)
210
- echo apply_filters("pmpro_memberslist_expires_column", date(get_option('date_format'), $auser->enddate), $auser);
211
  else
212
- echo __(apply_filters("pmpro_memberslist_expires_column", "Never", $auser), "pmpro");
213
  ?>
214
  </td>
215
  </tr>
203
  -
204
  <?php } ?>
205
  </td>
206
+ <td><?php echo date(get_option("date_format"), strtotime($theuser->user_registered))?></td>
207
  <td>
208
  <?php
209
  if($auser->enddate)
210
+ echo date(get_option('date_format'), $auser->enddate);
211
  else
212
+ echo __("Never", "pmpro");
213
  ?>
214
  </td>
215
  </tr>
adminpages/orders-csv.php CHANGED
@@ -103,26 +103,26 @@
103
  {
104
  if($predefined_date == "Last Month")
105
  {
106
- $start_date = date("Y-m-d", strtotime("first day of last month", current_time("timestamp")));
107
- $end_date = date("Y-m-d", strtotime("last day of last month", current_time("timestamp")));
108
  }
109
  elseif($predefined_date == "This Month")
110
  {
111
- $start_date = date("Y-m-d", strtotime("first day of this month", current_time("timestamp")));
112
- $end_date = date("Y-m-d", strtotime("last day of this month", current_time("timestamp")));
113
  }
114
  elseif($predefined_date == "This Year")
115
  {
116
  $year = date('Y');
117
- $start_date = date("Y-m-d", strtotime("first day of January $year", current_time("timestamp")));
118
- $end_date = date("Y-m-d", strtotime("last day of December $year", current_time("timestamp")));
119
  }
120
 
121
  elseif($predefined_date == "Last Year")
122
  {
123
  $year = date('Y') - 1;
124
- $start_date = date("Y-m-d", strtotime("first day of January $year", current_time("timestamp")));
125
- $end_date = date("Y-m-d", strtotime("last day of December $year", current_time("timestamp")));
126
  }
127
 
128
  //add times to dates
103
  {
104
  if($predefined_date == "Last Month")
105
  {
106
+ $start_date = date("Y-m-d", strtotime("first day of last month"));
107
+ $end_date = date("Y-m-d", strtotime("last day of last month"));
108
  }
109
  elseif($predefined_date == "This Month")
110
  {
111
+ $start_date = date("Y-m-d", strtotime("first day of this month"));
112
+ $end_date = date("Y-m-d", strtotime("last day of this month"));
113
  }
114
  elseif($predefined_date == "This Year")
115
  {
116
  $year = date('Y');
117
+ $start_date = date("Y-m-d", strtotime("first day of January $year"));
118
+ $end_date = date("Y-m-d", strtotime("last day of December $year"));
119
  }
120
 
121
  elseif($predefined_date == "Last Year")
122
  {
123
  $year = date('Y') - 1;
124
+ $start_date = date("Y-m-d", strtotime("first day of January $year"));
125
+ $end_date = date("Y-m-d", strtotime("last day of December $year"));
126
  }
127
 
128
  //add times to dates
adminpages/orders.php CHANGED
@@ -481,7 +481,7 @@
481
  <tr>
482
  <th scope="row" valign="top"><label for="subscription_transaction_id"><?php _e('Subscription Transaction ID', 'pmpro');?>:</label></th>
483
  <td>
484
- <?php if(in_array("subscription_transaction_id", $read_only_fields) && $order_id > 0) { echo $order->subscription_transaction_id; } else { ?>
485
  <input id="subscription_transaction_id" name="subscription_transaction_id" type="text" size="50" value="<?php echo esc_attr($order->subscription_transaction_id);?>" />
486
  <?php } ?>
487
  <small class="pmpro_lite"><?php _e('Generated by the gateway. Useful to cross reference subscriptions.', 'pmpro');?></small>
@@ -497,7 +497,7 @@
497
  if(!empty($order->timestamp))
498
  $timestamp = $order->timestamp;
499
  else
500
- $timestamp = current_time('timestamp');
501
 
502
  $year = date("Y", $timestamp);
503
  $month = date("n", $timestamp);
@@ -508,7 +508,7 @@
508
  for($i = 1; $i < 13; $i++)
509
  {
510
  ?>
511
- <option value="<?php echo $i?>" <?php if($i == $month) { ?>selected="selected"<?php } ?>><?php echo date("M", strtotime($i . "/1/" . $year, current_time("timestamp")))?></option>
512
  <?php
513
  }
514
  ?>
@@ -813,26 +813,26 @@
813
  {
814
  if($predefined_date == "Last Month")
815
  {
816
- $start_date = date("Y-m-d", strtotime("first day of last month", current_time("timestamp")));
817
- $end_date = date("Y-m-d", strtotime("last day of last month", current_time("timestamp")));
818
  }
819
  elseif($predefined_date == "This Month")
820
  {
821
- $start_date = date("Y-m-d", strtotime("first day of this month", current_time("timestamp")));
822
- $end_date = date("Y-m-d", strtotime("last day of this month", current_time("timestamp")));
823
  }
824
  elseif($predefined_date == "This Year")
825
  {
826
  $year = date('Y');
827
- $start_date = date("Y-m-d", strtotime("first day of January $year", current_time("timestamp")));
828
- $end_date = date("Y-m-d", strtotime("last day of December $year", current_time("timestamp")));
829
  }
830
 
831
  elseif($predefined_date == "Last Year")
832
  {
833
  $year = date('Y') - 1;
834
- $start_date = date("Y-m-d", strtotime("first day of January $year", current_time("timestamp")));
835
- $end_date = date("Y-m-d", strtotime("last day of December $year", current_time("timestamp")));
836
  }
837
 
838
  //add times to dates
481
  <tr>
482
  <th scope="row" valign="top"><label for="subscription_transaction_id"><?php _e('Subscription Transaction ID', 'pmpro');?>:</label></th>
483
  <td>
484
+ <?php if(in_array("code", $read_only_fields) && $order_id > 0) { echo $order->subscription_transaction_id; } else { ?>
485
  <input id="subscription_transaction_id" name="subscription_transaction_id" type="text" size="50" value="<?php echo esc_attr($order->subscription_transaction_id);?>" />
486
  <?php } ?>
487
  <small class="pmpro_lite"><?php _e('Generated by the gateway. Useful to cross reference subscriptions.', 'pmpro');?></small>
497
  if(!empty($order->timestamp))
498
  $timestamp = $order->timestamp;
499
  else
500
+ $timestamp = time();
501
 
502
  $year = date("Y", $timestamp);
503
  $month = date("n", $timestamp);
508
  for($i = 1; $i < 13; $i++)
509
  {
510
  ?>
511
+ <option value="<?php echo $i?>" <?php if($i == $month) { ?>selected="selected"<?php } ?>><?php echo date("M", strtotime($i . "/1/" . $year))?></option>
512
  <?php
513
  }
514
  ?>
813
  {
814
  if($predefined_date == "Last Month")
815
  {
816
+ $start_date = date("Y-m-d", strtotime("first day of last month"));
817
+ $end_date = date("Y-m-d", strtotime("last day of last month"));
818
  }
819
  elseif($predefined_date == "This Month")
820
  {
821
+ $start_date = date("Y-m-d", strtotime("first day of this month"));
822
+ $end_date = date("Y-m-d", strtotime("last day of this month"));
823
  }
824
  elseif($predefined_date == "This Year")
825
  {
826
  $year = date('Y');
827
+ $start_date = date("Y-m-d", strtotime("first day of January $year"));
828
+ $end_date = date("Y-m-d", strtotime("last day of December $year"));
829
  }
830
 
831
  elseif($predefined_date == "Last Year")
832
  {
833
  $year = date('Y') - 1;
834
+ $start_date = date("Y-m-d", strtotime("first day of January $year"));
835
+ $end_date = date("Y-m-d", strtotime("last day of December $year"));
836
  }
837
 
838
  //add times to dates
adminpages/pagesettings.php CHANGED
@@ -48,29 +48,29 @@
48
  {
49
  switch ($pmpro_page_name) {
50
  case 'account':
51
- $pmpro_page_title = __( 'Membership Account', 'pmpro' );
52
  break;
53
  case 'billing':
54
- $pmpro_page_title = __( 'Membership Billing', 'pmpro' );
55
  break;
56
  case 'cancel':
57
- $pmpro_page_title = __( 'Membership Cancel', 'pmpro' );
58
  break;
59
  case 'checkout':
60
- $pmpro_page_title = __( 'Membership Checkout', 'pmpro' );
61
  break;
62
  case 'confirmation':
63
- $pmpro_page_title = __( 'Membership Confirmation', 'pmpro' );
64
  break;
65
  case 'invoice':
66
- $pmpro_page_title = __( 'Membership Invoice', 'pmpro' );
67
  break;
68
  case 'levels':
69
- $pmpro_page_title = __( 'Membership Levels', 'pmpro' );
70
  break;
71
 
72
  default:
73
- $pmpro_page_title = sprintf( __( 'Membership %s', 'Page title template', 'pmpro' ), ucwords($pmpro_page_name) );
74
  break;
75
  }
76
 
48
  {
49
  switch ($pmpro_page_name) {
50
  case 'account':
51
+ $pmpro_page_title = _x( 'Membership Account', 'Page title', 'pmpro' );
52
  break;
53
  case 'billing':
54
+ $pmpro_page_title = _x( 'Membership Billing', 'Page title', 'pmpro' );
55
  break;
56
  case 'cancel':
57
+ $pmpro_page_title = _x( 'Membership Cancel', 'Page title', 'pmpro' );
58
  break;
59
  case 'checkout':
60
+ $pmpro_page_title = _x( 'Membership Checkout', 'Page title', 'pmpro' );
61
  break;
62
  case 'confirmation':
63
+ $pmpro_page_title = _x( 'Membership Confirmation', 'Page title', 'pmpro' );
64
  break;
65
  case 'invoice':
66
+ $pmpro_page_title = _x( 'Membership Invoice', 'Page title', 'pmpro' );
67
  break;
68
  case 'levels':
69
+ $pmpro_page_title = _x( 'Membership Levels', 'Page title', 'pmpro' );
70
  break;
71
 
72
  default:
73
+ $pmpro_page_title = sprintf( _x( 'Membership %s', 'Page title template', 'pmpro' ), ucwords($pmpro_page_name) );
74
  break;
75
  }
76
 
adminpages/reports/login.php CHANGED
@@ -182,7 +182,7 @@ function pmpro_report_login_page()
182
  <?php echo $theuser->display_name;?>
183
  </td>
184
  <td><?php echo $auser->membership?></td>
185
- <td><?php echo date("m/d/Y", strtotime($theuser->user_registered, current_time("timestamp")))?></td>
186
  <td>
187
  <?php
188
  if($auser->enddate)
182
  <?php echo $theuser->display_name;?>
183
  </td>
184
  <td><?php echo $auser->membership?></td>
185
+ <td><?php echo date("m/d/Y", strtotime($theuser->user_registered))?></td>
186
  <td>
187
  <?php
188
  if($auser->enddate)
adminpages/reports/memberships.php CHANGED
@@ -479,7 +479,7 @@ function pmpro_getCancellations($period = false, $levels = 'all')
479
  else
480
  $startdate = '';
481
 
482
- $startdate_plus_one = strtotime( $startdate . + ' + 1 day', current_time("timestamp") );
483
 
484
  /*
485
  build query.
479
  else
480
  $startdate = '';
481
 
482
+ $startdate_plus_one = strtotime( $startdate . + ' + 1 day' );
483
 
484
  /*
485
  build query.
classes/class.memberorder.php CHANGED
@@ -125,7 +125,7 @@
125
  return $this->Gateway;
126
  }
127
 
128
- function getLastMemberOrder($user_id = NULL, $status = 'success', $membership_id = NULL)
129
  {
130
  global $current_user, $wpdb;
131
  if(!$user_id)
@@ -140,9 +140,6 @@
140
  $this->sqlQuery .= "AND status IN('" . implode("','", $status) . "') ";
141
  elseif(!empty($status))
142
  $this->sqlQuery .= "AND status = '" . esc_sql($status) . "' ";
143
-
144
- if(!empty($membership_id))
145
- $this->sqlQuery .= "AND membership_id = '" . $membership_id . "' ";
146
  $this->sqlQuery .= "ORDER BY timestamp DESC LIMIT 1";
147
 
148
  //get id
@@ -217,9 +214,6 @@
217
  global $wpdb;
218
  $this->discount_code = $wpdb->get_row("SELECT dc.* FROM $wpdb->pmpro_discount_codes dc LEFT JOIN $wpdb->pmpro_discount_codes_uses dcu ON dc.id = dcu.code_id WHERE dcu.order_id = '" . $this->id . "' LIMIT 1");
219
 
220
- //filter @since v1.7.14
221
- $this->discount_code = apply_filters("pmpro_order_discount_code", $this->discount_code, $this);
222
-
223
  return $this->discount_code;
224
  }
225
 
@@ -255,13 +249,7 @@
255
  //okay, do I have a discount code to check? (if there is no membership_level->membership_id value, that means there was no entry in memberships_users)
256
  if(!empty($this->discount_code) && empty($this->membership_level->membership_id))
257
  {
258
- if(!empty($this->discount_code->code))
259
- $discount_code = $this->discount_code->code;
260
- else
261
- $discount_code = $this->discount_code;
262
-
263
- $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 = '" . $this->membership_id . "' LIMIT 1";
264
-
265
  $this->membership_level = $wpdb->get_row($sqlQuery);
266
  }
267
 
@@ -287,7 +275,7 @@
287
  if($tax_state && $tax_rate)
288
  {
289
  //we have values, is this order in the tax state?
290
- if(!empty($this->billing) && trim(strtoupper($this->billing->state)) == trim(strtoupper($tax_state)))
291
  {
292
  //return value, pass through filter
293
  $tax = round((float)$price * (float)$tax_rate, 2);
@@ -491,7 +479,7 @@
491
  '" . $this->gateway_environment . "',
492
  '" . esc_sql($this->payment_transaction_id) . "',
493
  '" . esc_sql($this->subscription_transaction_id) . "',
494
- '" . current_time('mysql') . "',
495
  '" . esc_sql($this->affiliate_id) . "',
496
  '" . esc_sql($this->affiliate_subid) . "',
497
  '" . esc_sql($this->notes) . "'
@@ -518,7 +506,7 @@
518
 
519
  while(empty($code))
520
  {
521
- $scramble = md5(AUTH_KEY . current_time('timestamp') . SECURE_AUTH_KEY);
522
  $code = substr($scramble, 0, 10);
523
  $code = apply_filters("pmpro_random_code", $code, $this); //filter
524
  $check = $wpdb->get_var("SELECT id FROM $wpdb->pmpro_membership_orders WHERE code = '$code' LIMIT 1");
@@ -589,16 +577,6 @@
589
  return $this->Gateway->update($this);
590
  }
591
 
592
- function getGatewaySubscriptionStatus()
593
- {
594
- return $this->Gateway->getSubscriptionStatus($this);
595
- }
596
-
597
- function getGatewayTransactionStatus()
598
- {
599
- return $this->Gateway->getTransactionStatus($this);
600
- }
601
-
602
  function deleteMe()
603
  {
604
  if(empty($this->id))
125
  return $this->Gateway;
126
  }
127
 
128
+ function getLastMemberOrder($user_id = NULL, $status = 'success')
129
  {
130
  global $current_user, $wpdb;
131
  if(!$user_id)
140
  $this->sqlQuery .= "AND status IN('" . implode("','", $status) . "') ";
141
  elseif(!empty($status))
142
  $this->sqlQuery .= "AND status = '" . esc_sql($status) . "' ";
 
 
 
143
  $this->sqlQuery .= "ORDER BY timestamp DESC LIMIT 1";
144
 
145
  //get id
214
  global $wpdb;
215
  $this->discount_code = $wpdb->get_row("SELECT dc.* FROM $wpdb->pmpro_discount_codes dc LEFT JOIN $wpdb->pmpro_discount_codes_uses dcu ON dc.id = dcu.code_id WHERE dcu.order_id = '" . $this->id . "' LIMIT 1");
216
 
 
 
 
217
  return $this->discount_code;
218
  }
219
 
249
  //okay, do I have a discount code to check? (if there is no membership_level->membership_id value, that means there was no entry in memberships_users)
250
  if(!empty($this->discount_code) && empty($this->membership_level->membership_id))
251
  {
252
+ $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 = '" . $this->discount_code . "' AND cl.level_id = '" . $this->membership_id . "' LIMIT 1";
 
 
 
 
 
 
253
  $this->membership_level = $wpdb->get_row($sqlQuery);
254
  }
255
 
275
  if($tax_state && $tax_rate)
276
  {
277
  //we have values, is this order in the tax state?
278
+ if(trim(strtoupper($this->billing->state)) == trim(strtoupper($tax_state)))
279
  {
280
  //return value, pass through filter
281
  $tax = round((float)$price * (float)$tax_rate, 2);
479
  '" . $this->gateway_environment . "',
480
  '" . esc_sql($this->payment_transaction_id) . "',
481
  '" . esc_sql($this->subscription_transaction_id) . "',
482
+ now(),
483
  '" . esc_sql($this->affiliate_id) . "',
484
  '" . esc_sql($this->affiliate_subid) . "',
485
  '" . esc_sql($this->notes) . "'
506
 
507
  while(empty($code))
508
  {
509
+ $scramble = md5(AUTH_KEY . time() . SECURE_AUTH_KEY);
510
  $code = substr($scramble, 0, 10);
511
  $code = apply_filters("pmpro_random_code", $code, $this); //filter
512
  $check = $wpdb->get_var("SELECT id FROM $wpdb->pmpro_membership_orders WHERE code = '$code' LIMIT 1");
577
  return $this->Gateway->update($this);
578
  }
579
 
 
 
 
 
 
 
 
 
 
 
580
  function deleteMe()
581
  {
582
  if(empty($this->id))
classes/class.pmproemail.php CHANGED
@@ -44,8 +44,6 @@
44
 
45
  $this->headers = array("Content-Type: text/html");
46
 
47
- $this->attachments = NULL;
48
-
49
  //load the template
50
  $locale = apply_filters("plugin_locale", get_locale(), "pmpro");
51
  if(file_exists(get_stylesheet_directory() . "/paid-memberships-pro/email/" . $this->template . ".html"))
@@ -100,9 +98,8 @@
100
  $this->template = apply_filters("pmpro_email_template", $temail->template, $this);
101
  $this->body = apply_filters("pmpro_email_body", $temail->body, $this);
102
  $this->headers = apply_filters("pmpro_email_headers", $temail->headers, $this);
103
- $this->attachments = apply_filters("pmpro_email_attachments", $temail->attachments, $this);
104
-
105
- if(wp_mail($this->email,$this->subject,$this->body,$this->headers,$this->attachments))
106
  {
107
  return true;
108
  }
@@ -186,7 +183,7 @@
186
  "membership_id" => $user->membership_level->id,
187
  "membership_level_name" => $user->membership_level->name,
188
  "membership_cost" => pmpro_getLevelCost($user->membership_level),
189
- "login_link" => wp_login_url(pmpro_url("account")),
190
  "display_name" => $user->display_name,
191
  "user_email" => $user->user_email,0
192
  );
@@ -286,7 +283,7 @@
286
  "membership_id" => $user->membership_level->id,
287
  "membership_level_name" => $user->membership_level->name,
288
  "membership_cost" => pmpro_getLevelCost($user->membership_level),
289
- "login_link" => wp_login_url(pmpro_url("account")),
290
  "display_name" => $user->display_name,
291
  "user_email" => $user->user_email,0
292
  );
@@ -387,7 +384,7 @@
387
  "accountnumber" => hideCardNumber($invoice->accountnumber),
388
  "expirationmonth" => $invoice->expirationmonth,
389
  "expirationyear" => $invoice->expirationyear,
390
- "login_link" => wp_login_url(pmpro_url("account"))
391
  );
392
  $this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name,
393
  $invoice->billing->street,
@@ -488,7 +485,7 @@
488
  "accountnumber" => hideCardNumber($invoice->accountnumber),
489
  "expirationmonth" => $invoice->expirationmonth,
490
  "expirationyear" => $invoice->expirationyear,
491
- "login_link" => wp_login_url(pmpro_url("billing"))
492
  );
493
  $this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name,
494
  $invoice->billing->street,
@@ -534,7 +531,7 @@
534
  "accountnumber" => hideCardNumber($invoice->accountnumber),
535
  "expirationmonth" => $invoice->expirationmonth,
536
  "expirationyear" => $invoice->expirationyear,
537
- "login_link" => wp_login_url(pmpro_url("billing"))
538
  );
539
  $this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name,
540
  $invoice->billing->street,
@@ -581,7 +578,7 @@
581
  "accountnumber" => hideCardNumber($invoice->accountnumber),
582
  "expirationmonth" => $invoice->expirationmonth,
583
  "expirationyear" => $invoice->expirationyear,
584
- "login_link" => wp_login_url(pmpro_url("billing"))
585
  );
586
  $this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name,
587
  $invoice->billing->street,
@@ -632,9 +629,9 @@
632
  "accountnumber" => hideCardNumber($invoice->accountnumber),
633
  "expirationmonth" => $invoice->expirationmonth,
634
  "expirationyear" => $invoice->expirationyear,
635
- "login_link" => wp_login_url(pmpro_url("account")),
636
- "invoice_link" => wp_login_url(pmpro_url("invoice", "?invoice=" . $invoice->code)
637
- ));
638
  $this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name,
639
  $invoice->billing->street,
640
  "", //address 2
@@ -694,7 +691,7 @@
694
  "cycle_period" => $user->membership_level->cycle_period,
695
  "trial_amount" => $pmpro_currency_symbol . $user->membership_level->trial_amount,
696
  "trial_limit" => $user->membership_level->trial_limit,
697
- "trial_end" => date(get_option('date_format'), strtotime(date("m/d/Y", $user->membership_level->startdate) . " + " . $user->membership_level->trial_limit . " " . $user->membership_level->cycle_period), current_time("timestamp"))
698
  );
699
 
700
  return $this->sendEmail();
@@ -799,7 +796,7 @@
799
  if($user->membership_level->ID)
800
  $this->data["membership_change"] = sprintf(__("The new level is %s. This membership is free", "pmpro"), $user->membership_level->name);
801
  else
802
- $this->data["membership_change"] = __("Membership has been cancelled", "pmpro");
803
 
804
  if(!empty($user->membership_level->enddate))
805
  {
44
 
45
  $this->headers = array("Content-Type: text/html");
46
 
 
 
47
  //load the template
48
  $locale = apply_filters("plugin_locale", get_locale(), "pmpro");
49
  if(file_exists(get_stylesheet_directory() . "/paid-memberships-pro/email/" . $this->template . ".html"))
98
  $this->template = apply_filters("pmpro_email_template", $temail->template, $this);
99
  $this->body = apply_filters("pmpro_email_body", $temail->body, $this);
100
  $this->headers = apply_filters("pmpro_email_headers", $temail->headers, $this);
101
+
102
+ if(wp_mail($this->email,$this->subject,$this->body,$this->headers))
 
103
  {
104
  return true;
105
  }
183
  "membership_id" => $user->membership_level->id,
184
  "membership_level_name" => $user->membership_level->name,
185
  "membership_cost" => pmpro_getLevelCost($user->membership_level),
186
+ "login_link" => pmpro_url("account"),
187
  "display_name" => $user->display_name,
188
  "user_email" => $user->user_email,0
189
  );
283
  "membership_id" => $user->membership_level->id,
284
  "membership_level_name" => $user->membership_level->name,
285
  "membership_cost" => pmpro_getLevelCost($user->membership_level),
286
+ "login_link" => pmpro_url("account"),
287
  "display_name" => $user->display_name,
288
  "user_email" => $user->user_email,0
289
  );
384
  "accountnumber" => hideCardNumber($invoice->accountnumber),
385
  "expirationmonth" => $invoice->expirationmonth,
386
  "expirationyear" => $invoice->expirationyear,
387
+ "login_link" => pmpro_url("account")
388
  );
389
  $this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name,
390
  $invoice->billing->street,
485
  "accountnumber" => hideCardNumber($invoice->accountnumber),
486
  "expirationmonth" => $invoice->expirationmonth,
487
  "expirationyear" => $invoice->expirationyear,
488
+ "login_link" => pmpro_url("billing")
489
  );
490
  $this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name,
491
  $invoice->billing->street,
531
  "accountnumber" => hideCardNumber($invoice->accountnumber),
532
  "expirationmonth" => $invoice->expirationmonth,
533
  "expirationyear" => $invoice->expirationyear,
534
+ "login_link" => pmpro_url("billing")
535
  );
536
  $this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name,
537
  $invoice->billing->street,
578
  "accountnumber" => hideCardNumber($invoice->accountnumber),
579
  "expirationmonth" => $invoice->expirationmonth,
580
  "expirationyear" => $invoice->expirationyear,
581
+ "login_link" => pmpro_url("billing")
582
  );
583
  $this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name,
584
  $invoice->billing->street,
629
  "accountnumber" => hideCardNumber($invoice->accountnumber),
630
  "expirationmonth" => $invoice->expirationmonth,
631
  "expirationyear" => $invoice->expirationyear,
632
+ "login_link" => pmpro_url("account"),
633
+ "invoice_link" => pmpro_url("invoice", "?invoice=" . $invoice->code)
634
+ );
635
  $this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name,
636
  $invoice->billing->street,
637
  "", //address 2
691
  "cycle_period" => $user->membership_level->cycle_period,
692
  "trial_amount" => $pmpro_currency_symbol . $user->membership_level->trial_amount,
693
  "trial_limit" => $user->membership_level->trial_limit,
694
+ "trial_end" => date(get_option('date_format'), strtotime(date("m/d/Y", $user->membership_level->startdate) . " + " . $user->membership_level->trial_limit . " " . $user->membership_level->cycle_period))
695
  );
696
 
697
  return $this->sendEmail();
796
  if($user->membership_level->ID)
797
  $this->data["membership_change"] = sprintf(__("The new level is %s. This membership is free", "pmpro"), $user->membership_level->name);
798
  else
799
+ $this->data["membership_change"] = __("membership has been cancelled", "pmpro");
800
 
801
  if(!empty($user->membership_level->enddate))
802
  {
classes/gateways/class.pmprogateway.php CHANGED
@@ -43,7 +43,7 @@
43
  else
44
  {
45
  //add a period to the start date to account for the initial payment
46
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
47
  }
48
 
49
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -90,7 +90,7 @@
90
  else
91
  {
92
  //add a period to the start date to account for the initial payment
93
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
94
  }
95
 
96
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -200,21 +200,5 @@
200
  $order->updateStatus("cancelled");
201
  return true;
202
  }
203
-
204
- function getSubscriptionStatus(&$order)
205
- {
206
- //require a subscription id
207
- if(empty($order->subscription_transaction_id))
208
- return false;
209
-
210
- //this looks different for each gateway, but generally an array of some sort
211
- return array();
212
- }
213
-
214
- function getTransactionStatus(&$order)
215
- {
216
- //this looks different for each gateway, but generally an array of some sort
217
- return array();
218
- }
219
  }
220
  ?>
43
  else
44
  {
45
  //add a period to the start date to account for the initial payment
46
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
47
  }
48
 
49
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
90
  else
91
  {
92
  //add a period to the start date to account for the initial payment
93
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod)) . "T0:0:0";
94
  }
95
 
96
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
200
  $order->updateStatus("cancelled");
201
  return true;
202
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  }
204
  ?>
classes/gateways/class.pmprogateway_authorizenet.php CHANGED
@@ -43,7 +43,7 @@
43
  else
44
  {
45
  //add a period to the start date to account for the initial payment
46
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
47
  }
48
 
49
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -90,7 +90,7 @@
90
  else
91
  {
92
  //add a period to the start date to account for the initial payment
93
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
94
  }
95
 
96
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
43
  else
44
  {
45
  //add a period to the start date to account for the initial payment
46
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
47
  }
48
 
49
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
90
  else
91
  {
92
  //add a period to the start date to account for the initial payment
93
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
94
  }
95
 
96
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
classes/gateways/class.pmprogateway_braintree.php CHANGED
@@ -296,13 +296,13 @@
296
  $trial_period_days = $order->BillingFrequency * 30; //assume monthly
297
 
298
  //convert to a profile start date
299
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
300
 
301
  //filter the start date
302
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
303
 
304
  //convert back to days
305
- $trial_period_days = ceil(abs(strtotime(date("Y-m-d")) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
306
 
307
  //now add the actual trial set by the site
308
  if(!empty($order->TrialBillingCycles))
296
  $trial_period_days = $order->BillingFrequency * 30; //assume monthly
297
 
298
  //convert to a profile start date
299
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day")) . "T0:0:0";
300
 
301
  //filter the start date
302
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
303
 
304
  //convert back to days
305
+ $trial_period_days = ceil(abs(strtotime(date("Y-m-d")) - strtotime($order->ProfileStartDate)) / 86400);
306
 
307
  //now add the actual trial set by the site
308
  if(!empty($order->TrialBillingCycles))
classes/gateways/class.pmprogateway_check.php CHANGED
@@ -48,7 +48,7 @@
48
  else
49
  {
50
  //add a period to the start date to account for the initial payment
51
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
52
  }
53
 
54
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -95,7 +95,7 @@
95
  else
96
  {
97
  //add a period to the start date to account for the initial payment
98
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
99
  }
100
 
101
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
48
  else
49
  {
50
  //add a period to the start date to account for the initial payment
51
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
52
  }
53
 
54
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
95
  else
96
  {
97
  //add a period to the start date to account for the initial payment
98
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod)) . "T0:0:0";
99
  }
100
 
101
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
classes/gateways/class.pmprogateway_cybersource.php CHANGED
@@ -45,7 +45,7 @@
45
  else
46
  {
47
  //add a period to the start date to account for the initial payment
48
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
49
  }
50
 
51
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -92,7 +92,7 @@
92
  else
93
  {
94
  //add a period to the start date to account for the initial payment
95
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
96
  }
97
 
98
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
@@ -464,13 +464,13 @@
464
  $trial_period_days = $order->BillingFrequency * 30; //assume monthly
465
 
466
  //convert to a profile start date
467
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
468
 
469
  //filter the start date
470
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
471
 
472
  //convert back to days
473
- $trial_period_days = ceil(abs(strtotime(date("Y-m-d"), current_time('timestamp')) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
474
 
475
  //now add the actual trial set by the site
476
  if(!empty($order->TrialBillingCycles))
@@ -762,4 +762,4 @@
762
  else
763
  return "Unknown error.";
764
  }
765
- }
45
  else
46
  {
47
  //add a period to the start date to account for the initial payment
48
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
49
  }
50
 
51
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
92
  else
93
  {
94
  //add a period to the start date to account for the initial payment
95
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod)) . "T0:0:0";
96
  }
97
 
98
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
464
  $trial_period_days = $order->BillingFrequency * 30; //assume monthly
465
 
466
  //convert to a profile start date
467
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day")) . "T0:0:0";
468
 
469
  //filter the start date
470
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
471
 
472
  //convert back to days
473
+ $trial_period_days = ceil(abs(strtotime(date("Y-m-d")) - strtotime($order->ProfileStartDate)) / 86400);
474
 
475
  //now add the actual trial set by the site
476
  if(!empty($order->TrialBillingCycles))
762
  else
763
  return "Unknown error.";
764
  }
765
+ }
classes/gateways/class.pmprogateway_payflowpro.php CHANGED
@@ -17,7 +17,7 @@
17
  if($authorization_id)
18
  {
19
  $this->void($order, $authorization_id);
20
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
21
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
22
  return $this->subscribe($order);
23
  }
@@ -36,7 +36,7 @@
36
  //setup recurring billing
37
  if(pmpro_isLevelRecurring($order->membership_level))
38
  {
39
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
40
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
41
  if($this->subscribe($order))
42
  {
@@ -159,7 +159,7 @@
159
 
160
  //paypal profile stuff
161
  $nvpStr = "";
162
- $nvpStr .="&AMT=" . $amount . "&TAXAMT=" . $amount_tax . "&CURRENCY=" . $pmpro_currency;
163
  $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
164
  //$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
165
 
@@ -179,7 +179,7 @@
179
  $nvpStr .= "&CITY=" . $order->billing->city . "&STATE=" . $order->billing->state . "&BILLTOCOUNTRY=" . $order->billing->country . "&ZIP=" . $order->billing->zip . "&PHONENUM=" . $order->billing->phone;
180
  }
181
 
182
- $this->nvpStr = $nvpStr;
183
  $this->httpParsedResponseAr = $this->PPHttpPost('S', $nvpStr);
184
 
185
  if("0" == strtoupper($this->httpParsedResponseAr["RESULT"])) {
@@ -219,7 +219,7 @@
219
 
220
  //paypal profile stuff
221
  $nvpStr = "&ACTION=A";
222
- $nvpStr .="&AMT=" . $amount . "&TAXAMT=" . $amount_tax . "&CURRENCY=" . $pmpro_currency;
223
  $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
224
  //$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
225
 
@@ -253,13 +253,13 @@
253
  $trial_period_days = $order->BillingFrequency * 30; //assume monthly
254
 
255
  //convert to a profile start date
256
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
257
 
258
  //filter the start date
259
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
260
 
261
  //convert back to days
262
- $trial_period_days = ceil(abs(strtotime(date("Y-m-d"), current_time('timestamp')) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
263
 
264
  //now add the actual trial set by the site
265
  if(!empty($order->TrialBillingCycles))
@@ -276,7 +276,7 @@
276
  }
277
 
278
  //convert back into a date
279
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
280
 
281
  //start date
282
  $nvpStr .= "&START=" . date("mdY", strtotime($order->ProfileStartDate));
@@ -365,13 +365,10 @@
365
  $this->nvpStr = $nvpStr;
366
  $this->httpParsedResponseAr = $this->PPHttpPost('R', $nvpStr);
367
 
368
- if("0" == strtoupper($this->httpParsedResponseAr["RESULT"]))
369
- {
370
  $order->updateStatus("cancelled");
371
  return true;
372
- }
373
- else
374
- {
375
  $order->status = "error";
376
  $order->errorcode = $this->httpParsedResponseAr['RESULT'];
377
  $order->error = urldecode($this->httpParsedResponseAr['RESPMSG']);
@@ -445,4 +442,4 @@
445
 
446
  return $httpParsedResponseAr;
447
  }
448
- }
17
  if($authorization_id)
18
  {
19
  $this->void($order, $authorization_id);
20
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
21
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
22
  return $this->subscribe($order);
23
  }
36
  //setup recurring billing
37
  if(pmpro_isLevelRecurring($order->membership_level))
38
  {
39
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
40
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
41
  if($this->subscribe($order))
42
  {
159
 
160
  //paypal profile stuff
161
  $nvpStr = "";
162
+ $nvpStr .="&AMT=" . $amount . "&TAXAMT=" . $amount_tax;
163
  $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
164
  //$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
165
 
179
  $nvpStr .= "&CITY=" . $order->billing->city . "&STATE=" . $order->billing->state . "&BILLTOCOUNTRY=" . $order->billing->country . "&ZIP=" . $order->billing->zip . "&PHONENUM=" . $order->billing->phone;
180
  }
181
 
182
+ $this->nvpStr = $nvpStr;
183
  $this->httpParsedResponseAr = $this->PPHttpPost('S', $nvpStr);
184
 
185
  if("0" == strtoupper($this->httpParsedResponseAr["RESULT"])) {
219
 
220
  //paypal profile stuff
221
  $nvpStr = "&ACTION=A";
222
+ $nvpStr .="&AMT=" . $amount . "&TAXAMT=" . $amount_tax;
223
  $nvpStr .= "&NOTIFYURL=" . urlencode(admin_url('admin-ajax.php') . "?action=ipnhandler");
224
  //$nvpStr .= "&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=" . $order->PaymentAmount;
225
 
253
  $trial_period_days = $order->BillingFrequency * 30; //assume monthly
254
 
255
  //convert to a profile start date
256
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day")) . "T0:0:0";
257
 
258
  //filter the start date
259
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
260
 
261
  //convert back to days
262
+ $trial_period_days = ceil(abs(strtotime(date("Y-m-d")) - strtotime($order->ProfileStartDate)) / 86400);
263
 
264
  //now add the actual trial set by the site
265
  if(!empty($order->TrialBillingCycles))
276
  }
277
 
278
  //convert back into a date
279
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day")) . "T0:0:0";
280
 
281
  //start date
282
  $nvpStr .= "&START=" . date("mdY", strtotime($order->ProfileStartDate));
365
  $this->nvpStr = $nvpStr;
366
  $this->httpParsedResponseAr = $this->PPHttpPost('R', $nvpStr);
367
 
368
+ if("0" == strtoupper($this->httpParsedResponseAr["RESULT"])) {
 
369
  $order->updateStatus("cancelled");
370
  return true;
371
+ } else {
 
 
372
  $order->status = "error";
373
  $order->errorcode = $this->httpParsedResponseAr['RESULT'];
374
  $order->error = urldecode($this->httpParsedResponseAr['RESPMSG']);
442
 
443
  return $httpParsedResponseAr;
444
  }
445
+ }
classes/gateways/class.pmprogateway_paypal.php CHANGED
@@ -17,7 +17,7 @@
17
  if($authorization_id)
18
  {
19
  $this->void($order, $authorization_id);
20
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
21
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
22
  return $this->subscribe($order);
23
  }
@@ -36,7 +36,7 @@
36
  //setup recurring billing
37
  if(pmpro_isLevelRecurring($order->membership_level))
38
  {
39
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
40
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
41
  if($this->subscribe($order))
42
  {
@@ -369,23 +369,21 @@
369
  {
370
  //paypal profile stuff
371
  $nvpStr = "";
372
- $nvpStr .= "&PROFILEID=" . urlencode($order->subscription_transaction_id) . "&ACTION=Cancel&NOTE=" . urlencode("User requested cancel.");
373
 
374
  $this->httpParsedResponseAr = $this->PPHttpPost('ManageRecurringPaymentsProfileStatus', $nvpStr);
375
 
376
- if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"]))
377
- {
378
  $order->updateStatus("cancelled");
379
- return true;
380
- }
381
- else
382
- {
383
  $order->status = "error";
384
  $order->errorcode = $this->httpParsedResponseAr['L_ERRORCODE0'];
385
- $order->error = urldecode($this->httpParsedResponseAr['L_LONGMESSAGE0']) . ". " . __("Please contact the site owner or cancel your subscription from within PayPal to make sure you are not charged going forward.", "pmpro");
386
  $order->shorterror = urldecode($this->httpParsedResponseAr['L_SHORTMESSAGE0']);
387
-
388
- return false;
389
  }
390
  }
391
 
17
  if($authorization_id)
18
  {
19
  $this->void($order, $authorization_id);
20
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
21
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
22
  return $this->subscribe($order);
23
  }
36
  //setup recurring billing
37
  if(pmpro_isLevelRecurring($order->membership_level))
38
  {
39
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
40
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
41
  if($this->subscribe($order))
42
  {
369
  {
370
  //paypal profile stuff
371
  $nvpStr = "";
372
+ $nvpStr .= "&PROFILEID=" . $order->subscription_transaction_id . "&ACTION=Cancel&NOTE=User requested cancel.";
373
 
374
  $this->httpParsedResponseAr = $this->PPHttpPost('ManageRecurringPaymentsProfileStatus', $nvpStr);
375
 
376
+ if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"]) || $this->httpParsedResponseAr['L_ERRORCODE0'] == "11556") {
 
377
  $order->updateStatus("cancelled");
378
+ return true;
379
+ //exit('CreateRecurringPaymentsProfile Completed Successfully: '.print_r($this->httpParsedResponseAr, true));
380
+ } else {
 
381
  $order->status = "error";
382
  $order->errorcode = $this->httpParsedResponseAr['L_ERRORCODE0'];
383
+ $order->error = urldecode($this->httpParsedResponseAr['L_LONGMESSAGE0']);
384
  $order->shorterror = urldecode($this->httpParsedResponseAr['L_SHORTMESSAGE0']);
385
+ return false;
386
+ //exit('CreateRecurringPaymentsProfile failed: ' . print_r($httpParsedResponseAr, true));
387
  }
388
  }
389
 
classes/gateways/class.pmprogateway_paypalexpress.php CHANGED
@@ -12,7 +12,7 @@
12
  {
13
  if(pmpro_isLevelRecurring($order->membership_level))
14
  {
15
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
16
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
17
  return $this->subscribe($order);
18
  }
@@ -47,7 +47,7 @@
47
  //paypal profile stuff
48
  $nvpStr = "";
49
  $nvpStr .="&AMT=" . $initial_payment . "&CURRENCYCODE=" . $pmpro_currency;
50
- if(!empty($order->ProfileStartDate) && strtotime($order->ProfileStartDate, current_time("timestamp")) > 0)
51
  $nvpStr .= "&PROFILESTARTDATE=" . $order->ProfileStartDate;
52
  if(!empty($order->BillingFrequency))
53
  $nvpStr .= "&BILLINGPERIOD=" . $order->BillingPeriod . "&BILLINGFREQUENCY=" . $order->BillingFrequency . "&AUTOBILLAMT=AddToNextBilling&L_BILLINGTYPE0=RecurringPayments";
@@ -89,10 +89,6 @@
89
 
90
  $nvpStr .= "&CANCELURL=" . urlencode(pmpro_url("levels"));
91
 
92
- $account_optional = apply_filters('pmpro_paypal_account_optional', true);
93
- if ($account_optional)
94
- $nvpStr .= '&SOLUTIONTYPE=Sole&LANDINGPAGE=Billing';
95
-
96
  $nvpStr = apply_filters("pmpro_set_express_checkout_nvpstr", $nvpStr, $order);
97
 
98
  ///echo str_replace("&", "&<br />", $nvpStr);
@@ -289,51 +285,24 @@
289
  {
290
  //paypal profile stuff
291
  $nvpStr = "";
292
- $nvpStr .= "&PROFILEID=" . urlencode($order->subscription_transaction_id) . "&ACTION=Cancel&NOTE=" . urlencode("User requested cancel.");
293
 
294
  $this->httpParsedResponseAr = $this->PPHttpPost('ManageRecurringPaymentsProfileStatus', $nvpStr);
295
 
296
- if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"]))
297
- {
298
  $order->updateStatus("cancelled");
299
- return true;
300
- }
301
- else
302
- {
303
  $order->status = "error";
304
  $order->errorcode = $this->httpParsedResponseAr['L_ERRORCODE0'];
305
- $order->error = urldecode($this->httpParsedResponseAr['L_LONGMESSAGE0']) . ". " . __("Please contact the site owner or cancel your subscription from within PayPal to make sure you are not charged going forward.", "pmpro");
306
  $order->shorterror = urldecode($this->httpParsedResponseAr['L_SHORTMESSAGE0']);
307
 
308
- return false;
309
- }
310
- }
311
-
312
- function getSubscriptionStatus(&$order)
313
- {
314
- if(empty($order->subscription_transaction_id))
315
  return false;
316
-
317
- //paypal profile stuff
318
- $nvpStr = "";
319
- $nvpStr .= "&PROFILEID=" . urlencode($order->subscription_transaction_id);
320
-
321
- $this->httpParsedResponseAr = $this->PPHttpPost('GetRecurringPaymentsProfileDetails', $nvpStr);
322
-
323
- if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"]))
324
- {
325
- return $this->httpParsedResponseAr;
326
- }
327
- else
328
- {
329
- $order->status = "error";
330
- $order->errorcode = $this->httpParsedResponseAr['L_ERRORCODE0'];
331
- $order->error = urldecode($this->httpParsedResponseAr['L_LONGMESSAGE0']);
332
- $order->shorterror = urldecode($this->httpParsedResponseAr['L_SHORTMESSAGE0']);
333
-
334
- return false;
335
  }
336
- }
337
 
338
  /**
339
  * PAYPAL Function
@@ -399,4 +368,4 @@
399
 
400
  return $httpParsedResponseAr;
401
  }
402
- }
12
  {
13
  if(pmpro_isLevelRecurring($order->membership_level))
14
  {
15
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
16
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
17
  return $this->subscribe($order);
18
  }
47
  //paypal profile stuff
48
  $nvpStr = "";
49
  $nvpStr .="&AMT=" . $initial_payment . "&CURRENCYCODE=" . $pmpro_currency;
50
+ if(!empty($order->ProfileStartDate) && strtotime($order->ProfileStartDate) > 0)
51
  $nvpStr .= "&PROFILESTARTDATE=" . $order->ProfileStartDate;
52
  if(!empty($order->BillingFrequency))
53
  $nvpStr .= "&BILLINGPERIOD=" . $order->BillingPeriod . "&BILLINGFREQUENCY=" . $order->BillingFrequency . "&AUTOBILLAMT=AddToNextBilling&L_BILLINGTYPE0=RecurringPayments";
89
 
90
  $nvpStr .= "&CANCELURL=" . urlencode(pmpro_url("levels"));
91
 
 
 
 
 
92
  $nvpStr = apply_filters("pmpro_set_express_checkout_nvpstr", $nvpStr, $order);
93
 
94
  ///echo str_replace("&", "&<br />", $nvpStr);
285
  {
286
  //paypal profile stuff
287
  $nvpStr = "";
288
+ $nvpStr .= "&PROFILEID=" . $order->subscription_transaction_id . "&ACTION=Cancel&NOTE=User requested cancel.";
289
 
290
  $this->httpParsedResponseAr = $this->PPHttpPost('ManageRecurringPaymentsProfileStatus', $nvpStr);
291
 
292
+ if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"]) || $this->httpParsedResponseAr['L_ERRORCODE0'] == "11556") {
 
293
  $order->updateStatus("cancelled");
294
+ return true;
295
+ //exit('CreateRecurringPaymentsProfile Completed Successfully: '.print_r($this->httpParsedResponseAr, true));
296
+ } else {
 
297
  $order->status = "error";
298
  $order->errorcode = $this->httpParsedResponseAr['L_ERRORCODE0'];
299
+ $order->error = urldecode($this->httpParsedResponseAr['L_LONGMESSAGE0']);
300
  $order->shorterror = urldecode($this->httpParsedResponseAr['L_SHORTMESSAGE0']);
301
 
 
 
 
 
 
 
 
302
  return false;
303
+ //exit('CreateRecurringPaymentsProfile failed: ' . print_r($httpParsedResponseAr, true));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  }
305
+ }
306
 
307
  /**
308
  * PAYPAL Function
368
 
369
  return $httpParsedResponseAr;
370
  }
371
+ }
classes/gateways/class.pmprogateway_paypalstandard.php CHANGED
@@ -114,13 +114,13 @@
114
  else
115
  {
116
  //we can try to work in any change in ProfileStartDate
117
- $psd = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp"))) . "T0:0:0";
118
  $adjusted_psd = apply_filters("pmpro_profile_start_date", $psd, $order);
119
  if($psd != $adjusted_psd)
120
  {
121
  //someone is trying to push the start date back
122
- $adjusted_psd_time = strtotime($adjusted_psd, current_time("timestamp"));
123
- $seconds_til_psd = $adjusted_psd_time - current_time('timestamp');
124
  $days_til_psd = floor($seconds_til_psd/(60*60*24));
125
 
126
  //push back trial one by days_til_psd
@@ -144,20 +144,9 @@
144
  if(!empty($order->TotalBillingCycles))
145
  {
146
  if(!empty($trial_amount))
147
- {
148
-
149
- $srt = intval($order->TotalBillingCycles) - 1; //subtract one for the trial period
150
- }
151
- else
152
- {
153
- $srt = intval($order->TotalBillingCycles);
154
- }
155
-
156
- //srt must be at least 2 or the subscription is not "recurring" according to paypal
157
- if($srt > 1)
158
- $paypal_args['srt'] = $srt;
159
  else
160
- $paypal_args['src'] = '0';
161
  }
162
  else
163
  $paypal_args['srt'] = '0'; //indefinite subscription
@@ -195,17 +184,13 @@
195
  foreach($additional_parameters as $key => $value)
196
  $nvpStr .= urlencode("&" . $key . "=" . $value);
197
  }
198
-
199
- $account_optional = apply_filters('pmpro_paypal_account_optional', true);
200
- if ($account_optional)
201
- $nvpStr .= '&SOLUTIONTYPE=Sole&LANDINGPAGE=Billing';
202
 
203
  $nvpStr = apply_filters("pmpro_paypal_standard_nvpstr", $nvpStr, $order);
204
 
205
  //redirect to paypal
206
  $paypal_url .= $nvpStr;
207
 
208
- //wp_die(str_replace("&", "<br />", $paypal_url));
209
 
210
  wp_redirect($paypal_url);
211
  exit;
@@ -219,19 +204,18 @@
219
 
220
  $this->httpParsedResponseAr = $this->PPHttpPost('ManageRecurringPaymentsProfileStatus', $nvpStr);
221
 
222
- if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"]))
223
- {
224
  $order->updateStatus("cancelled");
225
- return true;
226
- }
227
- else
228
- {
229
  $order->status = "error";
230
  $order->errorcode = $this->httpParsedResponseAr['L_ERRORCODE0'];
231
- $order->error = urldecode($this->httpParsedResponseAr['L_LONGMESSAGE0']) . ". " . __("Please contact the site owner or cancel your subscription from within PayPal to make sure you are not charged going forward.", "pmpro");
232
  $order->shorterror = urldecode($this->httpParsedResponseAr['L_SHORTMESSAGE0']);
233
 
234
- return false;
 
235
  }
236
  }
237
 
@@ -299,4 +283,4 @@
299
 
300
  return $httpParsedResponseAr;
301
  }
302
- }
114
  else
115
  {
116
  //we can try to work in any change in ProfileStartDate
117
+ $psd = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
118
  $adjusted_psd = apply_filters("pmpro_profile_start_date", $psd, $order);
119
  if($psd != $adjusted_psd)
120
  {
121
  //someone is trying to push the start date back
122
+ $adjusted_psd_time = strtotime($adjusted_psd);
123
+ $seconds_til_psd = $adjusted_psd_time - time();
124
  $days_til_psd = floor($seconds_til_psd/(60*60*24));
125
 
126
  //push back trial one by days_til_psd
144
  if(!empty($order->TotalBillingCycles))
145
  {
146
  if(!empty($trial_amount))
147
+ $paypal_args['srt'] = intval($order->TotalBillingCycles) - 1; //subtract 1 for the trial period
 
 
 
 
 
 
 
 
 
 
 
148
  else
149
+ $paypal_args['srt'] = intval($order->TotalBillingCycles);
150
  }
151
  else
152
  $paypal_args['srt'] = '0'; //indefinite subscription
184
  foreach($additional_parameters as $key => $value)
185
  $nvpStr .= urlencode("&" . $key . "=" . $value);
186
  }
 
 
 
 
187
 
188
  $nvpStr = apply_filters("pmpro_paypal_standard_nvpstr", $nvpStr, $order);
189
 
190
  //redirect to paypal
191
  $paypal_url .= $nvpStr;
192
 
193
+ //die($paypal_url);
194
 
195
  wp_redirect($paypal_url);
196
  exit;
204
 
205
  $this->httpParsedResponseAr = $this->PPHttpPost('ManageRecurringPaymentsProfileStatus', $nvpStr);
206
 
207
+ if("SUCCESS" == strtoupper($this->httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($this->httpParsedResponseAr["ACK"]) || $this->httpParsedResponseAr['L_ERRORCODE0'] == "11556") {
 
208
  $order->updateStatus("cancelled");
209
+ return true;
210
+ //exit('CreateRecurringPaymentsProfile Completed Successfully: '.print_r($this->httpParsedResponseAr, true));
211
+ } else {
 
212
  $order->status = "error";
213
  $order->errorcode = $this->httpParsedResponseAr['L_ERRORCODE0'];
214
+ $order->error = urldecode($this->httpParsedResponseAr['L_LONGMESSAGE0']);
215
  $order->shorterror = urldecode($this->httpParsedResponseAr['L_SHORTMESSAGE0']);
216
 
217
+ return false;
218
+ //exit('CreateRecurringPaymentsProfile failed: ' . print_r($httpParsedResponseAr, true));
219
  }
220
  }
221
 
283
 
284
  return $httpParsedResponseAr;
285
  }
286
+ }
classes/gateways/class.pmprogateway_stripe.php CHANGED
@@ -58,8 +58,6 @@
58
 
59
  function charge(&$order)
60
  {
61
- global $pmpro_currency;
62
-
63
  //create a code for the order
64
  if(empty($order->code))
65
  $order->code = $order->getRandomCode();
@@ -85,7 +83,7 @@
85
  {
86
  $response = Stripe_Charge::create(array(
87
  "amount" => $amount * 100, # amount in cents, again
88
- "currency" => $pmpro_currency,
89
  "customer" => $this->customer->id,
90
  "description" => "Order #" . $order->code . ", " . trim($order->FirstName . " " . $order->LastName) . " (" . $order->Email . ")"
91
  )
@@ -178,7 +176,7 @@
178
  }
179
 
180
  return $this->customer;
181
- }
182
  catch (Exception $e)
183
  {
184
  //assume no customer found
@@ -220,8 +218,8 @@
220
  }
221
  add_action("user_register", "pmpro_user_register_stripe_customerid");
222
  }
223
-
224
- return apply_filters('pmpro_stripe_create_customer', $this->customer);
225
  }
226
 
227
  return false;
@@ -229,8 +227,6 @@
229
 
230
  function subscribe(&$order)
231
  {
232
- global $pmpro_currency;
233
-
234
  //create a code for the order
235
  if(empty($order->code))
236
  $order->code = $order->getRandomCode();
@@ -266,13 +262,13 @@
266
  $trial_period_days = $order->BillingFrequency * 30; //assume monthly
267
 
268
  //convert to a profile start date
269
- $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day", current_time("timestamp"))) . "T0:0:0";
270
 
271
  //filter the start date
272
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
273
 
274
  //convert back to days
275
- $trial_period_days = ceil(abs(strtotime(date("Y-m-d"), current_time("timestamp")) - strtotime($order->ProfileStartDate, current_time("timestamp"))) / 86400);
276
 
277
  //now add the actual trial set by the site
278
  if(!empty($order->TrialBillingCycles))
@@ -290,18 +286,16 @@
290
 
291
  //create a plan
292
  try
293
- {
294
- $plan = array(
295
- "amount" => $amount * 100,
296
- "interval_count" => $order->BillingFrequency,
297
- "interval" => strtolower($order->BillingPeriod),
298
- "trial_period_days" => $trial_period_days,
299
- "name" => $order->membership_name . " for order " . $order->code,
300
- "currency" => strtolower($pmpro_currency),
301
- "id" => $order->code
302
- );
303
-
304
- $plan = Stripe_Plan::create(apply_filters('pmpro_stripe_create_plan_array', $plan));
305
  }
306
  catch (Exception $e)
307
  {
58
 
59
  function charge(&$order)
60
  {
 
 
61
  //create a code for the order
62
  if(empty($order->code))
63
  $order->code = $order->getRandomCode();
83
  {
84
  $response = Stripe_Charge::create(array(
85
  "amount" => $amount * 100, # amount in cents, again
86
+ "currency" => strtolower(pmpro_getOption("currency")),
87
  "customer" => $this->customer->id,
88
  "description" => "Order #" . $order->code . ", " . trim($order->FirstName . " " . $order->LastName) . " (" . $order->Email . ")"
89
  )
176
  }
177
 
178
  return $this->customer;
179
+ }
180
  catch (Exception $e)
181
  {
182
  //assume no customer found
218
  }
219
  add_action("user_register", "pmpro_user_register_stripe_customerid");
220
  }
221
+
222
+ return $this->customer;
223
  }
224
 
225
  return false;
227
 
228
  function subscribe(&$order)
229
  {
 
 
230
  //create a code for the order
231
  if(empty($order->code))
232
  $order->code = $order->getRandomCode();
262
  $trial_period_days = $order->BillingFrequency * 30; //assume monthly
263
 
264
  //convert to a profile start date
265
+ $order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $trial_period_days . " Day")) . "T0:0:0";
266
 
267
  //filter the start date
268
  $order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
269
 
270
  //convert back to days
271
+ $trial_period_days = ceil(abs(strtotime(date("Y-m-d")) - strtotime($order->ProfileStartDate)) / 86400);
272
 
273
  //now add the actual trial set by the site
274
  if(!empty($order->TrialBillingCycles))
286
 
287
  //create a plan
288
  try
289
+ {
290
+ $plan = Stripe_Plan::create(array(
291
+ "amount" => $amount * 100,
292
+ "interval_count" => $order->BillingFrequency,
293
+ "interval" => strtolower($order->BillingPeriod),
294
+ "trial_period_days" => $trial_period_days,
295
+ "name" => $order->membership_name . " for order " . $order->code,
296
+ "currency" => strtolower(pmpro_getOption("currency")),
297
+ "id" => $order->code)
298
+ );
 
 
299
  }
300
  catch (Exception $e)
301
  {
css/frontend.css CHANGED
@@ -63,8 +63,6 @@ fieldset[disabled] .pmpro_btn {
63
  ---------------------------------------*/
64
  form.pmpro_form div {clear: left; margin: .5em 0 1em 0; }
65
  form.pmpro_form label {float: left; margin: 3px 10px 0 0; width: 120px; font-weight: bold; text-align: right; }
66
- form.pmpro_form label.pmpro_normal {float: none; margin: 0 0 0 0; width: auto; font-weight: normal; text-align: auto;}
67
- .pmpro_clickable {cursor: pointer;}
68
  form.pmpro_form .likelabel {font-weight: bold; }
69
  form.pmpro_form .input, form.pmpro_form textarea, .input, form.pmpro_form select {padding: 3px; border: 1px solid #AAA; margin: 0 3px 0 0; }
70
  form.pmpro_form textarea {font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
63
  ---------------------------------------*/
64
  form.pmpro_form div {clear: left; margin: .5em 0 1em 0; }
65
  form.pmpro_form label {float: left; margin: 3px 10px 0 0; width: 120px; font-weight: bold; text-align: right; }
 
 
66
  form.pmpro_form .likelabel {font-weight: bold; }
67
  form.pmpro_form .input, form.pmpro_form textarea, .input, form.pmpro_form select {padding: 3px; border: 1px solid #AAA; margin: 0 3px 0 0; }
68
  form.pmpro_form textarea {font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
email/checkout_check.html CHANGED
@@ -11,7 +11,7 @@
11
 
12
  <p>
13
  Invoice #!!invoice_id!! on !!invoice_date!!<br />
14
- Total Billed: !!invoice_total!!
15
  </p>
16
 
17
  <p>Log in to your membership account here: !!login_link!!</p>
11
 
12
  <p>
13
  Invoice #!!invoice_id!! on !!invoice_date!!<br />
14
+ Total Billed: $!!invoice_total!!
15
  </p>
16
 
17
  <p>Log in to your membership account here: !!login_link!!</p>
includes/adminpages.php CHANGED
@@ -1,73 +1,28 @@
1
  <?php
2
- /*
3
- Get array of PMPro Capabilities
4
- */
5
- function pmpro_getPMProCaps()
6
- {
7
- $pmpro_caps = array(
8
- //pmpro_memberships_menu //this controls viewing the menu itself
9
- 'pmpro_membershiplevels',
10
- 'pmpro_pagesettings',
11
- 'pmpro_paymentsettings',
12
- 'pmpro_emailsettings',
13
- 'pmpro_advancedsettings',
14
- 'pmpro_addons',
15
- 'pmpro_memberslist',
16
- 'pmpro_reports',
17
- 'pmpro_orders',
18
- 'pmpro_discountcodes'
19
- );
20
-
21
- return $pmpro_caps;
22
- }
23
-
24
  /*
25
  Dashboard Menu
26
  */
27
  function pmpro_add_pages()
28
  {
29
- global $wpdb;
30
 
31
- //array of all caps in the menu
32
- $pmpro_caps = pmpro_getPMProCaps();
33
-
34
- //the top level menu links to the first page they have access to
35
- foreach($pmpro_caps as $cap)
36
- {
37
- if(current_user_can($cap))
38
- {
39
- $top_menu_cap = $cap;
40
- break;
41
- }
42
- }
43
-
44
- if(empty($top_menu_cap))
45
- return;
46
-
47
- add_menu_page(__('Memberships', 'pmpro'), __('Memberships', 'pmpro'), 'pmpro_memberships_menu', 'pmpro-membershiplevels', $top_menu_cap, PMPRO_URL . '/images/menu_users.png');
48
- add_submenu_page('pmpro-membershiplevels', __('Page Settings', 'pmpro'), __('Page Settings', 'pmpro'), 'pmpro_pagesettings', 'pmpro-pagesettings', 'pmpro_pagesettings');
49
- add_submenu_page('pmpro-membershiplevels', __('Payment Settings', 'pmpro'), __('Payment Settings', 'pmpro'), 'pmpro_paymentsettings', 'pmpro-paymentsettings', 'pmpro_paymentsettings');
50
- add_submenu_page('pmpro-membershiplevels', __('Email Settings', 'pmpro'), __('Email Settings', 'pmpro'), 'pmpro_emailsettings', 'pmpro-emailsettings', 'pmpro_emailsettings');
51
- add_submenu_page('pmpro-membershiplevels', __('Advanced Settings', 'pmpro'), __('Advanced Settings', 'pmpro'), 'pmpro_advancedsettings', 'pmpro-advancedsettings', 'pmpro_advancedsettings');
52
- add_submenu_page('pmpro-membershiplevels', __('Add Ons', 'pmpro'), __('Add Ons', 'pmpro'), 'pmpro_addons', 'pmpro-addons', 'pmpro_addons');
53
- add_submenu_page('pmpro-membershiplevels', __('Members List', 'pmpro'), __('Members List', 'pmpro'), 'pmpro_memberslist', 'pmpro-memberslist', 'pmpro_memberslist');
54
- add_submenu_page('pmpro-membershiplevels', __('Reports', 'pmpro'), __('Reports', 'pmpro'), 'pmpro_reports', 'pmpro-reports', 'pmpro_reports');
55
- add_submenu_page('pmpro-membershiplevels', __('Orders', 'pmpro'), __('Orders', 'pmpro'), 'pmpro_orders', 'pmpro-orders', 'pmpro_orders');
56
- add_submenu_page('pmpro-membershiplevels', __('Discount Codes', 'pmpro'), __('Discount Codes', 'pmpro'), 'pmpro_discountcodes', 'pmpro-discountcodes', 'pmpro_discountcodes');
57
 
58
  //rename the automatically added Memberships submenu item
59
  global $submenu;
60
  if(!empty($submenu['pmpro-membershiplevels']))
61
  {
62
- if(current_user_can("pmpro_membershiplevels"))
63
- {
64
- $submenu['pmpro-membershiplevels'][0][0] = __( 'Membership Levels', 'pmpro' );
65
- $submenu['pmpro-membershiplevels'][0][3] = __( 'Membership Levels', 'pmpro' );
66
- }
67
- else
68
- {
69
- unset($submenu['pmpro-membershiplevels']);
70
- }
71
  }
72
  }
73
  add_action('admin_menu', 'pmpro_add_pages');
@@ -77,98 +32,62 @@ add_action('admin_menu', 'pmpro_add_pages');
77
  */
78
  function pmpro_admin_bar_menu() {
79
  global $wp_admin_bar;
80
-
81
- //view menu at all?
82
- if ( !current_user_can('pmpro_memberships_menu') || !is_admin_bar_showing() )
83
  return;
84
-
85
- //array of all caps in the menu
86
- $pmpro_caps = pmpro_getPMProCaps();
87
-
88
- //the top level menu links to the first page they have access to
89
- foreach($pmpro_caps as $cap)
90
- {
91
- if(current_user_can($cap))
92
- {
93
- $top_menu_page = str_replace("_", "-", $cap);
94
- break;
95
- }
96
- }
97
-
98
  $wp_admin_bar->add_menu( array(
99
  'id' => 'paid-memberships-pro',
100
  'title' => __( 'Memberships', 'pmpro'),
101
- 'href' => get_admin_url(NULL, '/admin.php?page=' . $top_menu_page) ) );
102
-
103
- if(current_user_can('pmpro_membershiplevels'))
104
- $wp_admin_bar->add_menu( array(
105
- 'id' => 'pmpro-membership-levels',
106
- 'parent' => 'paid-memberships-pro',
107
- 'title' => __( 'Membership Levels', 'pmpro'),
108
- 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-membershiplevels') ) );
109
-
110
- if(current_user_can('pmpro_pagesettings'))
111
- $wp_admin_bar->add_menu( array(
112
- 'id' => 'pmpro-page-settings',
113
- 'parent' => 'paid-memberships-pro',
114
- 'title' => __( 'Page Settings', 'pmpro'),
115
- 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-pagesettings') ) );
116
-
117
- if(current_user_can('pmpro_paymentsettings'))
118
- $wp_admin_bar->add_menu( array(
119
- 'id' => 'pmpro-payment-settings',
120
- 'parent' => 'paid-memberships-pro',
121
- 'title' => __( 'Payment Settings', 'pmpro'),
122
- 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-paymentsettings') ) );
123
-
124
- if(current_user_can('pmpro_emailsettings'))
125
- $wp_admin_bar->add_menu( array(
126
- 'id' => 'pmpro-email-settings',
127
- 'parent' => 'paid-memberships-pro',
128
- 'title' => __( 'Email Settings', 'pmpro'),
129
- 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-emailsettings') ) );
130
-
131
- if(current_user_can('pmpro_advancedsettings'))
132
- $wp_admin_bar->add_menu( array(
133
- 'id' => 'pmpro-advanced-settings',
134
- 'parent' => 'paid-memberships-pro',
135
- 'title' => __( 'Advanced Settings', 'pmpro'),
136
- 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-advancedsettings') ) );
137
-
138
- if(current_user_can('pmpro_addons'))
139
- $wp_admin_bar->add_menu( array(
140
- 'id' => 'pmpro-addons',
141
- 'parent' => 'paid-memberships-pro',
142
- 'title' => __( 'Add Ons', 'pmpro'),
143
- 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-addons') ) );
144
-
145
- if(current_user_can('pmpro_memberslist'))
146
- $wp_admin_bar->add_menu( array(
147
- 'id' => 'pmpro-members-list',
148
- 'parent' => 'paid-memberships-pro',
149
- 'title' => __( 'Members List', 'pmpro'),
150
- 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-memberslist') ) );
151
-
152
- if(current_user_can('pmpro_reports'))
153
- $wp_admin_bar->add_menu( array(
154
- 'id' => 'pmpro-reports',
155
- 'parent' => 'paid-memberships-pro',
156
- 'title' => __( 'Reports', 'pmpro'),
157
- 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-reports') ) );
158
-
159
- if(current_user_can('pmpro_orders'))
160
- $wp_admin_bar->add_menu( array(
161
- 'id' => 'pmpro-orders',
162
- 'parent' => 'paid-memberships-pro',
163
- 'title' => __( 'Orders', 'pmpro'),
164
- 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-orders') ) );
165
-
166
- if(current_user_can('pmpro_discountcodes'))
167
- $wp_admin_bar->add_menu( array(
168
- 'id' => 'pmpro-discount-codes',
169
- 'parent' => 'paid-memberships-pro',
170
- 'title' => __( 'Discount Codes', 'pmpro'),
171
- 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-discountcodes') ) );
172
  }
173
  add_action('admin_bar_menu', 'pmpro_admin_bar_menu', 1000);
174
 
@@ -223,4 +142,4 @@ function pmpro_addons()
223
  function pmpro_orders()
224
  {
225
  require_once(PMPRO_DIR . "/adminpages/orders.php");
226
- }
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /*
3
  Dashboard Menu
4
  */
5
  function pmpro_add_pages()
6
  {
7
+ global $wpdb;
8
 
9
+ add_menu_page(__('Memberships', 'pmpro'), __('Memberships', 'pmpro'), 'manage_options', 'pmpro-membershiplevels', 'pmpro_membershiplevels', PMPRO_URL . '/images/menu_users.png');
10
+ add_submenu_page('pmpro-membershiplevels', __('Page Settings', 'pmpro'), __('Page Settings', 'pmpro'), 'manage_options', 'pmpro-pagesettings', 'pmpro_pagesettings');
11
+ add_submenu_page('pmpro-membershiplevels', __('Payment Settings', 'pmpro'), __('Payment Settings', 'pmpro'), 'manage_options', 'pmpro-paymentsettings', 'pmpro_paymentsettings');
12
+ add_submenu_page('pmpro-membershiplevels', __('Email Settings', 'pmpro'), __('Email Settings', 'pmpro'), 'manage_options', 'pmpro-emailsettings', 'pmpro_emailsettings');
13
+ add_submenu_page('pmpro-membershiplevels', __('Advanced Settings', 'pmpro'), __('Advanced Settings', 'pmpro'), 'manage_options', 'pmpro-advancedsettings', 'pmpro_advancedsettings');
14
+ add_submenu_page('pmpro-membershiplevels', __('Add Ons', 'pmpro'), __('Add Ons', 'pmpro'), 'manage_options', 'pmpro-addons', 'pmpro_addons');
15
+ add_submenu_page('pmpro-membershiplevels', __('Members List', 'pmpro'), __('Members List', 'pmpro'), 'manage_options', 'pmpro-memberslist', 'pmpro_memberslist');
16
+ add_submenu_page('pmpro-membershiplevels', __('Reports', 'pmpro'), __('Reports', 'pmpro'), 'manage_options', 'pmpro-reports', 'pmpro_reports');
17
+ add_submenu_page('pmpro-membershiplevels', __('Orders', 'pmpro'), __('Orders', 'pmpro'), 'manage_options', 'pmpro-orders', 'pmpro_orders');
18
+ add_submenu_page('pmpro-membershiplevels', __('Discount Codes', 'pmpro'), __('Discount Codes', 'pmpro'), 'manage_options', 'pmpro-discountcodes', 'pmpro_discountcodes');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  //rename the automatically added Memberships submenu item
21
  global $submenu;
22
  if(!empty($submenu['pmpro-membershiplevels']))
23
  {
24
+ $submenu['pmpro-membershiplevels'][0][0] = "Membership Levels";
25
+ $submenu['pmpro-membershiplevels'][0][3] = "Membership Levels";
 
 
 
 
 
 
 
26
  }
27
  }
28
  add_action('admin_menu', 'pmpro_add_pages');
32
  */
33
  function pmpro_admin_bar_menu() {
34
  global $wp_admin_bar;
35
+ if ( !is_super_admin() || !is_admin_bar_showing() )
 
 
36
  return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  $wp_admin_bar->add_menu( array(
38
  'id' => 'paid-memberships-pro',
39
  'title' => __( 'Memberships', 'pmpro'),
40
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-membershiplevels') ) );
41
+ $wp_admin_bar->add_menu( array(
42
+ 'id' => 'pmpro-membership-levels',
43
+ 'parent' => 'paid-memberships-pro',
44
+ 'title' => __( 'Membership Levels', 'pmpro'),
45
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-membershiplevels') ) );
46
+ $wp_admin_bar->add_menu( array(
47
+ 'id' => 'pmpro-page-settings',
48
+ 'parent' => 'paid-memberships-pro',
49
+ 'title' => __( 'Page Settings', 'pmpro'),
50
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-pagesettings') ) );
51
+ $wp_admin_bar->add_menu( array(
52
+ 'id' => 'pmpro-payment-settings',
53
+ 'parent' => 'paid-memberships-pro',
54
+ 'title' => __( 'Payment Settings', 'pmpro'),
55
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-paymentsettings') ) );
56
+ $wp_admin_bar->add_menu( array(
57
+ 'id' => 'pmpro-email-settings',
58
+ 'parent' => 'paid-memberships-pro',
59
+ 'title' => __( 'Email Settings', 'pmpro'),
60
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-emailsettings') ) );
61
+ $wp_admin_bar->add_menu( array(
62
+ 'id' => 'pmpro-advanced-settings',
63
+ 'parent' => 'paid-memberships-pro',
64
+ 'title' => __( 'Advanced Settings', 'pmpro'),
65
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-advancedsettings') ) );
66
+ $wp_admin_bar->add_menu( array(
67
+ 'id' => 'pmpro-addons',
68
+ 'parent' => 'paid-memberships-pro',
69
+ 'title' => __( 'Add Ons', 'pmpro'),
70
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-addons') ) );
71
+ $wp_admin_bar->add_menu( array(
72
+ 'id' => 'pmpro-members-list',
73
+ 'parent' => 'paid-memberships-pro',
74
+ 'title' => __( 'Members List', 'pmpro'),
75
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-memberslist') ) );
76
+ $wp_admin_bar->add_menu( array(
77
+ 'id' => 'pmpro-reports',
78
+ 'parent' => 'paid-memberships-pro',
79
+ 'title' => __( 'Reports', 'pmpro'),
80
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-reports') ) );
81
+ $wp_admin_bar->add_menu( array(
82
+ 'id' => 'pmpro-orders',
83
+ 'parent' => 'paid-memberships-pro',
84
+ 'title' => __( 'Orders', 'pmpro'),
85
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-orders') ) );
86
+ $wp_admin_bar->add_menu( array(
87
+ 'id' => 'pmpro-discount-codes',
88
+ 'parent' => 'paid-memberships-pro',
89
+ 'title' => __( 'Discount Codes', 'pmpro'),
90
+ 'href' => get_admin_url(NULL, '/admin.php?page=pmpro-discountcodes') ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
  add_action('admin_bar_menu', 'pmpro_admin_bar_menu', 1000);
93
 
142
  function pmpro_orders()
143
  {
144
  require_once(PMPRO_DIR . "/adminpages/orders.php");
145
+ }
includes/content.php CHANGED
@@ -80,7 +80,6 @@ function pmpro_has_membership_access($post_id = NULL, $user_id = NULL, $return_m
80
  }
81
  elseif(!empty($myuser->ID))
82
  {
83
- $myuser->membership_level = pmpro_getMembershipLevelForUser($myuser->ID);
84
  if(!empty($myuser->membership_level->ID) && in_array($myuser->membership_level->ID, $post_membership_levels_ids))
85
  {
86
  //the users membership id is one that will grant access
@@ -106,7 +105,7 @@ function pmpro_has_membership_access($post_id = NULL, $user_id = NULL, $return_m
106
  //general filter for all posts
107
  $hasaccess = apply_filters("pmpro_has_membership_access_filter", $hasaccess, $mypost, $myuser, $post_membership_levels);
108
  //filter for this post type
109
- if(has_filter("pmpro_has_membership_access_filter_" . $mypost->post_type))
110
  $hasaccess = apply_filters("pmpro_has_membership_access_filter_" . $mypost->post_type, $hasaccess, $mypost, $myuser, $post_membership_levels);
111
 
112
  //return
@@ -118,76 +117,50 @@ function pmpro_has_membership_access($post_id = NULL, $user_id = NULL, $return_m
118
 
119
  function pmpro_search_filter($query)
120
  {
121
- global $current_user, $wpdb, $pmpro_pages;
122
-
123
- //hide pmpro pages from search results
124
- if(!$query->is_admin && $query->is_search && empty($query->query['post_parent']))
125
- {
126
- $query->set('post__not_in', $pmpro_pages ); // id of page or post
127
- }
128
-
129
- //hide member pages from non-members (make sure they aren't hidden from members)
130
- if(!$query->is_admin &&
131
- !$query->is_singular &&
132
- empty($query->query['post_parent']) &&
133
- (
134
- empty($query->query_vars['post_type']) ||
135
- in_array($query->query_vars['post_type'], apply_filters('pmpro_search_filter_post_types', array("page", "post")))
136
- )
137
- )
138
- {
139
- //get page ids that are in my levels
140
- $levels = pmpro_getMembershipLevelsForUser($current_user->ID);
141
- $my_pages = array();
142
-
143
- if($levels) {
144
- foreach($levels as $key => $level) {
145
- //get restricted posts for level
146
- $sql = "SELECT page_id FROM $wpdb->pmpro_memberships_pages WHERE membership_id=" . $current_user->membership_level->ID;
147
- $member_pages = $wpdb->get_col($sql);
148
- $my_pages = array_unique(array_merge($my_pages, $member_pages));
149
- }
150
- }
151
-
152
- //get hidden page ids
153
- if(!empty($my_pages))
154
- $sql = "SELECT page_id FROM $wpdb->pmpro_memberships_pages WHERE page_id NOT IN(" . implode(',', $my_pages) . ")";
155
- else
156
- $sql = "SELECT page_id FROM $wpdb->pmpro_memberships_pages";
157
- $hidden_page_ids = array_values(array_unique($wpdb->get_col($sql)));
158
-
159
- if($hidden_page_ids)
160
- $query->set('post__not_in', $hidden_page_ids);
161
 
162
- //get categories that are filtered by level, but not my level
163
- $my_cats = array();
164
-
165
- if($levels) {
166
- foreach($levels as $key => $level) {
167
- $member_cats = pmpro_getMembershipCategories($level->id);
168
- $my_cats = array_unique(array_merge($my_cats, $member_cats));
169
- }
170
- }
171
-
172
- //get hidden cats
173
- if(!empty($my_cats))
174
- $sql = "SELECT category_id FROM $wpdb->pmpro_memberships_categories WHERE category_id NOT IN(" . implode(',', $my_cats) . ")";
175
- else
176
- $sql = "SELECT category_id FROM $wpdb->pmpro_memberships_categories";
177
-
178
- $hidden_cat_ids = array_values(array_unique($wpdb->get_col($sql)));
179
 
180
- //make this work
181
- if($hidden_cat_ids)
182
- $query->set('category__not_in', $hidden_cat_ids);
183
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
- return $query;
186
  }
187
- $filterqueries = pmpro_getOption("filterqueries");
188
- if(!empty($filterqueries))
189
- add_filter( 'pre_get_posts', 'pmpro_search_filter' );
190
-
191
  function pmpro_membership_content_filter($content, $skipcheck = false)
192
  {
193
  global $post, $current_user;
80
  }
81
  elseif(!empty($myuser->ID))
82
  {
 
83
  if(!empty($myuser->membership_level->ID) && in_array($myuser->membership_level->ID, $post_membership_levels_ids))
84
  {
85
  //the users membership id is one that will grant access
105
  //general filter for all posts
106
  $hasaccess = apply_filters("pmpro_has_membership_access_filter", $hasaccess, $mypost, $myuser, $post_membership_levels);
107
  //filter for this post type
108
+ if(has_filter("pmpro_has_membership_access_action_" . $mypost->post_type))
109
  $hasaccess = apply_filters("pmpro_has_membership_access_filter_" . $mypost->post_type, $hasaccess, $mypost, $myuser, $post_membership_levels);
110
 
111
  //return
117
 
118
  function pmpro_search_filter($query)
119
  {
120
+ global $current_user, $wpdb, $pmpro_pages;