Paid Memberships Pro - Version 1.7.9.1

Version Description

  • Firing activation hook on upgrade so menu doesn't disappear.
Download this release

Release Info

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

Code changes from version 1.7.14 to 1.7.9.1

Files changed (112) hide show
  1. adminpages/addons/pmpro-addon-packages.php +1 -1
  2. adminpages/addons/pmpro-bbpress.php +1 -1
  3. adminpages/addons/pmpro-email-templates.php +1 -1
  4. adminpages/addons/pmpro-expiration.php +2 -2
  5. adminpages/addons/pmpro-infusionsoft.php +1 -1
  6. adminpages/addons/pmpro-mailchimp.php +1 -1
  7. adminpages/addons/pmpro-network-subsite.php +1 -1
  8. adminpages/addons/pmpro-post-affiliate-pro.php +1 -1
  9. adminpages/addons/pmpro-register-helper.php +1 -1
  10. adminpages/addons/pmpro-series.php +1 -1
  11. adminpages/addons/pmpro-shipping.php +1 -1
  12. adminpages/addons/pmpro-woocommerce.php +1 -1
  13. adminpages/addons/tml.php +1 -1
  14. adminpages/admin_header.php +1 -1
  15. adminpages/advancedsettings.php +4 -17
  16. adminpages/discountcodes.php +6 -6
  17. adminpages/memberslist-csv.php +2 -2
  18. adminpages/memberslist.php +3 -3
  19. adminpages/orders-csv.php +8 -8
  20. adminpages/orders.php +11 -11
  21. adminpages/pagesettings.php +8 -8
  22. adminpages/reports/login.php +1 -1
  23. adminpages/reports/memberships.php +1 -1
  24. classes/class.memberorder.php +4 -23
  25. classes/class.pmproemail.php +13 -16
  26. classes/gateways/class.pmprogateway.php +2 -18
  27. classes/gateways/class.pmprogateway_authorizenet.php +2 -2
  28. classes/gateways/class.pmprogateway_braintree.php +2 -2
  29. classes/gateways/class.pmprogateway_check.php +2 -2
  30. classes/gateways/class.pmprogateway_cybersource.php +5 -5
  31. classes/gateways/class.pmprogateway_payflowpro.php +9 -9
  32. classes/gateways/class.pmprogateway_paypal.php +2 -2
  33. classes/gateways/class.pmprogateway_paypalexpress.php +4 -34
  34. classes/gateways/class.pmprogateway_paypalstandard.php +7 -22
  35. classes/gateways/class.pmprogateway_stripe.php +16 -22
  36. css/frontend.css +0 -2
  37. email/checkout_check.html +1 -1
  38. includes/adminpages.php +3 -10
  39. includes/content.php +41 -68
  40. includes/email.php +9 -11
  41. includes/filters.php +2 -2
  42. includes/functions.php +99 -125
  43. includes/init.php +1 -30
  44. includes/login.php +2 -18
  45. includes/metaboxes.php +2 -2
  46. includes/profile.php +4 -4
  47. includes/services.php +1 -1
  48. includes/upgradecheck.php +1 -13
  49. languages/email/da_DK/admin_change.html +0 -7
  50. languages/email/da_DK/admin_change_admin.html +0 -5
  51. languages/email/da_DK/billing.html +0 -16
  52. languages/email/da_DK/billing_admin.html +0 -17
  53. languages/email/da_DK/billing_failure.html +0 -11
  54. languages/email/da_DK/billing_failure_admin.html +0 -11
  55. languages/email/da_DK/cancel.html +0 -3
  56. languages/email/da_DK/cancel_admin.html +0 -8
  57. languages/email/da_DK/checkout_check.html +0 -17
  58. languages/email/da_DK/checkout_check_admin.html +0 -17
  59. languages/email/da_DK/checkout_express.html +0 -14
  60. languages/email/da_DK/checkout_express_admin.html +0 -14
  61. languages/email/da_DK/checkout_free.html +0 -8
  62. languages/email/da_DK/checkout_free_admin.html +0 -8
  63. languages/email/da_DK/checkout_freetrial.html +0 -19
  64. languages/email/da_DK/checkout_freetrial_admin.html +0 -19
  65. languages/email/da_DK/checkout_paid.html +0 -23
  66. languages/email/da_DK/checkout_paid_admin.html +0 -23
  67. languages/email/da_DK/checkout_trial.html +0 -23
  68. languages/email/da_DK/checkout_trial_admin.html +0 -23
  69. languages/email/da_DK/credit_card_expiring.html +0 -13
  70. languages/email/da_DK/default.html +0 -1
  71. languages/email/da_DK/footer.html +0 -4
  72. languages/email/da_DK/header.html +0 -1
  73. languages/email/da_DK/invoice.html +0 -19
  74. languages/email/da_DK/membership_expired.html +0 -7
  75. languages/email/da_DK/membership_expiring.html +0 -6
  76. languages/email/da_DK/trial_ending.html +0 -8
  77. languages/pmpro-cs_CZ.mo +0 -0
  78. languages/pmpro-cs_CZ.po +0 -2889
  79. languages/pmpro-da_DK.mo +0 -0
  80. languages/pmpro-da_DK.po +0 -3502
  81. languages/pmpro-fr_FR.mo +0 -0
  82. languages/pmpro-fr_FR.po +3 -4
  83. languages/pmpro-it_IT.mo +0 -0
  84. languages/pmpro-it_IT.po +100 -227
  85. languages/pmpro-nb_NO.mo +0 -0
  86. languages/pmpro-nb_NO.po +0 -3279
  87. languages/pmpro-tr_TR.mo +0 -0
  88. languages/pmpro-tr_TR.po +0 -3470
  89. languages/pmpro.mo +0 -0
  90. languages/pmpro.po +262 -396
  91. languages/pmpro.pot +262 -396
  92. pages/account.php +2 -2
  93. pages/billing.php +2 -2
  94. pages/checkout.php +10 -14
  95. pages/confirmation.php +3 -3
  96. pages/invoice.php +2 -2
  97. pages/levels.php +5 -5
  98. paid-memberships-pro.php +8 -15
  99. preheaders/account.php +42 -37
  100. preheaders/billing.php +400 -372
  101. preheaders/cancel.php +40 -39
  102. preheaders/checkout.php +1090 -999
  103. preheaders/confirmation.php +12 -15
  104. preheaders/invoice.php +32 -32
  105. preheaders/levels.php +33 -32
  106. readme.txt +2 -60
  107. scheduled/crons.php +3 -3
  108. services/applydiscountcode.php +2 -8
  109. services/getfile.php +57 -5
  110. services/ipnhandler.php +15 -23
  111. services/twocheckout-ins.php +8 -12
  112. shortcodes/membership.php +2 -2
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
@@ -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>
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
@@ -217,9 +217,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 +252,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 +278,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 +482,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 +509,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 +580,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))
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
  return $this->discount_code;
221
  }
222
 
252
  //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)
253
  if(!empty($this->discount_code) && empty($this->membership_level->membership_id))
254
  {
255
+ $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";
 
 
 
 
 
 
256
  $this->membership_level = $wpdb->get_row($sqlQuery);
257
  }
258
 
278
  if($tax_state && $tax_rate)
279
  {
280
  //we have values, is this order in the tax state?
281
+ if(trim(strtoupper($this->billing->state)) == trim(strtoupper($tax_state)))
282
  {
283
  //return value, pass through filter
284
  $tax = round((float)$price * (float)$tax_rate, 2);
482
  '" . $this->gateway_environment . "',
483
  '" . esc_sql($this->payment_transaction_id) . "',
484
  '" . esc_sql($this->subscription_transaction_id) . "',
485
+ now(),
486
  '" . esc_sql($this->affiliate_id) . "',
487
  '" . esc_sql($this->affiliate_subid) . "',
488
  '" . esc_sql($this->notes) . "'
509
 
510
  while(empty($code))
511
  {
512
+ $scramble = md5(AUTH_KEY . time() . SECURE_AUTH_KEY);
513
  $code = substr($scramble, 0, 10);
514
  $code = apply_filters("pmpro_random_code", $code, $this); //filter
515
  $check = $wpdb->get_var("SELECT id FROM $wpdb->pmpro_membership_orders WHERE code = '$code' LIMIT 1");
580
  return $this->Gateway->update($this);
581
  }
582
 
 
 
 
 
 
 
 
 
 
 
583
  function deleteMe()
584
  {
585
  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));
@@ -445,4 +445,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));
445
 
446
  return $httpParsedResponseAr;
447
  }
448
+ }
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
  {
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
  {
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);
@@ -307,33 +303,7 @@
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 +369,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);
303
 
304
  return false;
305
  }
306
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
 
308
  /**
309
  * PAYPAL Function
369
 
370
  return $httpParsedResponseAr;
371
  }
372
+ }
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;
@@ -299,4 +284,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;
284
 
285
  return $httpParsedResponseAr;
286
  }
287
+ }
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
@@ -59,15 +59,8 @@ function pmpro_add_pages()
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');
@@ -223,4 +216,4 @@ function pmpro_addons()
223
  function pmpro_orders()
224
  {
225
  require_once(PMPRO_DIR . "/adminpages/orders.php");
226
- }
59
  global $submenu;
60
  if(!empty($submenu['pmpro-membershiplevels']))
61
  {
62
+ $submenu['pmpro-membershiplevels'][0][0] = "Membership Levels";
63
+ $submenu['pmpro-membershiplevels'][0][3] = "Membership Levels";
 
 
 
 
 
 
 
64
  }
65
  }
66
  add_action('admin_menu', 'pmpro_add_pages');
216
  function pmpro_orders()
217
  {
218
  require_once(PMPRO_DIR . "/adminpages/orders.php");
219
+ }
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;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
+ //hide pmpro pages from search results
123
+ if(!$query->is_admin && $query->is_search)
124
+ {
125
+ $query->set('post__not_in', $pmpro_pages ); // id of page or post
126
+ }
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
+ //hide member pages from non-members (make sure they aren't hidden from members)
129
+ if(!$query->is_admin && $query->is_search)
130
+ {
131
+ //get pages that are in levels, but not in mine
132
+ $sqlQuery1 = "SELECT page_id FROM $wpdb->pmpro_memberships_pages ";
133
+ if(!empty($current_user->membership_level->ID))
134
+ $sqlQuery1 .= "WHERE membership_id <> '" . $current_user->membership_level->ID . "' ";
135
+ $pages_in_levels_not_mine = $wpdb->get_col($sqlQuery1);
136
+
137
+ //get pages that are in my level
138
+ $sqlQuery2 = "SELECT page_id FROM $wpdb->pmpro_memberships_pages ";
139
+ if(!empty($current_user->membership_level->ID))
140
+ $sqlQuery2 .= "WHERE membership_id = '" . $current_user->membership_level->ID . "' ";
141
+ $pages_in_my_level = $wpdb->get_col($sqlQuery2);
142
+
143
+ $hidden_page_ids = array_diff($pages_in_levels_not_mine, $pages_in_my_level);
144
+ if($hidden_page_ids)
145
+ $query->set('post__not_in', $hidden_page_ids ); // id of page or post
146
+
147
+ //get categories that are filtered by level, but not my level
148
+ $sqlQuery = "SELECT category_id FROM $wpdb->pmpro_memberships_categories ";
149
+ if(!empty($current_user->membership_level->ID))
150
+ $sqlQuery .= "WHERE membership_id <> '" . $current_user->membership_level->ID . "' ";
151
+ $hidden_post_cats = $wpdb->get_col($sqlQuery);
152
+
153
+ //make this work
154
+ if($hidden_post_cats)
155
+ $query->set('category__not_in', $hidden_post_cats);
156
+ }
157
 
158
+ return $query;
159
  }
160
+ $showexcerpts = pmpro_getOption("showexcerpts");
161
+ if(empty($showexcerpts))
162
+ add_filter( 'pre_get_posts', 'pmpro_search_filter' );
163
+
164
  function pmpro_membership_content_filter($content, $skipcheck = false)
165
  {
166
  global $post, $current_user;
includes/email.php CHANGED
@@ -67,17 +67,15 @@ function pmpro_send_html( $phpmailer ) {
67
  // Convert line breaks & make links clickable
68
  $phpmailer->Body = make_clickable ($phpmailer->Body);
69
 
70
- // Add header to message if found
71
- if(file_exists(get_stylesheet_directory() . "/email_header.html"))
72
- $phpmailer->Body = file_get_contents(get_stylesheet_directory() . "/email_header.html") . "\n" . $phpmailer->Body;
73
- elseif(file_exists(get_template_directory() . "/email_header.html"))
74
- $phpmailer->Body = file_get_contents(get_template_directory() . "/email_header.html") . "\n" . $phpmailer->Body;
75
-
76
- // Add footer to message if found
77
- if(file_exists(get_stylesheet_directory() . "/email_footer.html"))
78
- $phpmailer->Body = $phpmailer->Body . "\n" . file_get_contents(get_stylesheet_directory() . "/email_footer.html");
79
- elseif(file_exists(get_template_directory() . "/email_footer.html"))
80
- $phpmailer->Body = $phpmailer->Body . "\n" . file_get_contents(get_template_directory() . "/email_footer.html");
81
 
82
  // Replace variables in email
83
  global $current_user;
67
  // Convert line breaks & make links clickable
68
  $phpmailer->Body = make_clickable ($phpmailer->Body);
69
 
70
+ // Add template to message
71
+ if(file_exists(TEMPLATEPATH . "/email_header.html"))
72
+ {
73
+ $phpmailer->Body = file_get_contents(TEMPLATEPATH . "/email_header.html") . "\n" . $phpmailer->Body;
74
+ }
75
+ if(file_exists(TEMPLATEPATH . "/email_footer.html"))
76
+ {
77
+ $phpmailer->Body = $phpmailer->Body . "\n" . file_get_contents(TEMPLATEPATH . "/email_footer.html");
78
+ }
 
 
79
 
80
  // Replace variables in email
81
  global $current_user;
includes/filters.php CHANGED
@@ -19,7 +19,7 @@ function pmpro_checkout_level_extend_memberships($level)
19
  $expiration_date = $current_user->membership_level->enddate;
20
 
21
  //calculate days left
22
- $todays_date = current_time('timestamp');
23
  $time_left = $expiration_date - $todays_date;
24
 
25
  //time left?
@@ -62,7 +62,7 @@ function pmpro_ipnhandler_level_extend_memberships($level, $user_id)
62
  $expiration_date = $user_level->enddate;
63
 
64
  //calculate days left
65
- $todays_date = current_time('timestamp');
66
  $time_left = $expiration_date - $todays_date;
67
 
68
  //time left?
19
  $expiration_date = $current_user->membership_level->enddate;
20
 
21
  //calculate days left
22
+ $todays_date = time();
23
  $time_left = $expiration_date - $todays_date;
24
 
25
  //time left?
62
  $expiration_date = $user_level->enddate;
63
 
64
  //calculate days left
65
+ $todays_date = time();
66
  $time_left = $expiration_date - $todays_date;
67
 
68
  //time left?
includes/functions.php CHANGED
@@ -103,13 +103,11 @@ function pmpro_setOption($s, $v = NULL)
103
  {
104
  //no value is given, set v to the request var
105
  if($v === NULL && isset($_REQUEST[$s]))
106
- $v = $_REQUEST[$s];
107
 
108
  if(is_array($v))
109
  $v = implode(",", $v);
110
- else
111
- $v = trim($v);
112
-
113
  return update_option("pmpro_" . $s, $v);
114
  }
115
 
@@ -201,9 +199,9 @@ function pmpro_getLevelCost(&$level, $tags = true, $short = false)
201
  global $pmpro_currency_symbol;
202
  //initial payment
203
  if(!$short)
204
- $r = sprintf(__('The price for membership is <strong>%s</strong> now', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2));
205
  else
206
- $r = sprintf(__('<strong>%s</strong> now', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2));
207
 
208
  //recurring part
209
  if($level->billing_amount != '0.00')
@@ -212,36 +210,36 @@ function pmpro_getLevelCost(&$level, $tags = true, $short = false)
212
  {
213
  if($level->cycle_number == '1')
214
  {
215
- $r .= sprintf(__(' and then <strong>%s per %s for %d more %s</strong>.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, pmpro_translate_billing_period($level->cycle_period), $level->billing_limit, pmpro_translate_billing_period($level->cycle_period, $level->billing_limit));
216
  }
217
  else
218
  {
219
- $r .= sprintf(__(' and then <strong>%s every %d %s for %d more %s</strong>.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number), $level->billing_limit, pmpro_translate_billing_period($level->cycle_period, $level->billing_limit));
220
  }
221
  }
222
  elseif($level->billing_limit == 1)
223
  {
224
- $r .= sprintf(__(' and then <strong>%s after %d %s</strong>.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
225
  }
226
  else
227
  {
228
  if( $level->billing_amount === $level->initial_payment ) {
229
  if($level->cycle_number == '1')
230
  {
231
- $r = sprintf(__('The price for membership is <strong>%s per %s</strong>.', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2), pmpro_translate_billing_period($level->cycle_period) );
232
  }
233
  else
234
  {
235
- $r = sprintf(__('The price for membership is <strong>%s every %d %s</strong>.', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number) );
236
  }
237
  } else {
238
  if($level->cycle_number == '1')
239
  {
240
- $r .= sprintf(__(' and then <strong>%s per %s</strong>.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, pmpro_translate_billing_period($level->cycle_period));
241
  }
242
  else
243
  {
244
- $r .= sprintf(__(' and then <strong>%s every %d %s</strong>.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
245
  }
246
  }
247
  }
@@ -259,22 +257,22 @@ function pmpro_getLevelCost(&$level, $tags = true, $short = false)
259
  {
260
  if($level->trial_limit == '1')
261
  {
262
- $r .= ' ' . __('After your initial payment, your first payment is Free.', 'pmpro');
263
  }
264
  else
265
  {
266
- $r .= ' ' . sprintf(__('After your initial payment, your first %d payments are Free.', 'pmpro'), $level->trial_limit);
267
  }
268
  }
269
  else
270
  {
271
  if($level->trial_limit == '1')
272
  {
273
- $r .= ' ' . sprintf(__('After your initial payment, your first payment will cost %s.', 'pmpro'), $pmpro_currency_symbol . $level->trial_amount);
274
  }
275
  else
276
  {
277
- $r .= ' ' . sprintf(__('After your initial payment, your first %d payments will cost %s.', 'pmpro'), $level->trial_limit, $pmpro_currency_symbol . $level->trial_amount);
278
  }
279
  }
280
  }
@@ -285,7 +283,7 @@ function pmpro_getLevelCost(&$level, $tags = true, $short = false)
285
 
286
  if($tax_state && $tax_rate && !pmpro_isLevelFree($level))
287
  {
288
- $r .= sprintf(__('Customers in %s will be charged %s%% tax.', 'pmpro'), $tax_state, round($tax_rate * 100, 2));
289
  }
290
 
291
  if(!$tags)
@@ -299,7 +297,7 @@ function pmpro_getLevelExpiration(&$level)
299
  {
300
  if($level->expiration_number)
301
  {
302
- $expiration_text = sprintf(__("Membership expires after %d %s.", "pmpro"), $level->expiration_number, pmpro_translate_billing_period($level->expiration_period, $level->expiration_number));
303
  }
304
  else
305
  $expiration_text = "";
@@ -577,7 +575,7 @@ function pmpro_changeMembershipLevel($level, $user_id = NULL)
577
  if(!empty($old_levels))
578
  {
579
  foreach($old_levels as $old_level) {
580
- $sql = "UPDATE $wpdb->pmpro_memberships_users SET `status`='inactive', `enddate`='" . current_time('mysql') . "' WHERE `id`=".$old_level->subscription_id;
581
  if(!$wpdb->query($sql))
582
  {
583
  $pmpro_error = __("Error interacting with database", "pmpro") . ": ".(mysql_errno()?mysql_error():'unavailable');
@@ -605,10 +603,10 @@ function pmpro_changeMembershipLevel($level, $user_id = NULL)
605
  if(is_array($level))
606
  {
607
  //make sure the dates are in good formats
608
- if($level['startdate'] != current_time('mysql') && $level['startdate'] != "NULL" && substr($level['startdate'], 0, 1) != "'")
609
  $level['startdate'] = "'" . $level['startdate'] . "'";
610
 
611
- if($level['enddate'] != current_time('mysql') && $level['enddate'] != "NULL" && substr($level['enddate'], 0, 1) != "'")
612
  $level['enddate'] = "'" . $level['enddate'] . "'";
613
 
614
  //Better support mySQL Strict Mode by passing a proper enum value for cycle_period
@@ -636,22 +634,7 @@ function pmpro_changeMembershipLevel($level, $user_id = NULL)
636
  }
637
  else
638
  {
639
- $sql = "INSERT INTO $wpdb->pmpro_memberships_users (user_id, membership_id, code_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, startdate, enddate)
640
- VALUES (
641
- '" . $user_id . "',
642
- '" . $level . "',
643
- '0',
644
- '0',
645
- '0',
646
- '0',
647
- '0',
648
- '0',
649
- '0',
650
- '0',
651
- '" . current_time('mysql') . "',
652
- '0000-00-00 00:00:00'
653
- )";
654
-
655
  if(!$wpdb->query($sql))
656
  {
657
  $pmpro_error = __("Error interacting with database", "pmpro") . ": ".(mysql_errno()?mysql_error():'unavailable');
@@ -768,13 +751,20 @@ function pmpro_updateMembershipCategories($level, $categories)
768
  function pmpro_getMembershipCategories($level_id)
769
  {
770
  global $wpdb;
771
- $categories = $wpdb->get_col("SELECT c.category_id
772
  FROM {$wpdb->pmpro_memberships_categories} AS c
773
- WHERE c.membership_id = '" . $level_id . "'");
774
-
775
- return $categories;
776
- }
777
 
 
 
 
 
 
 
 
 
 
 
778
 
779
  function pmpro_isAdmin($user_id = NULL)
780
  {
@@ -830,7 +820,6 @@ function pmpro_getMetavalues($query)
830
  global $wpdb;
831
 
832
  $results = $wpdb->get_results($query);
833
- $r = new stdClass();
834
  foreach($results as $result)
835
  {
836
  $r->{$result->key} = $result->value;
@@ -1079,7 +1068,7 @@ function pmpro_getDiscountCode($seed = NULL)
1079
 
1080
  while(empty($code))
1081
  {
1082
- $scramble = md5(AUTH_KEY . current_time('timestamp') . $seed . SECURE_AUTH_KEY);
1083
  $code = substr($scramble, 0, 10);
1084
  $check = $wpdb->get_var("SELECT code FROM $wpdb->pmpro_discount_codes WHERE code = '$code' LIMIT 1");
1085
  if($check || is_numeric($code))
@@ -1094,94 +1083,85 @@ function pmpro_checkDiscountCode($code, $level_id = NULL, $return_errors = false
1094
  {
1095
  global $wpdb;
1096
 
1097
- $error = false;
1098
-
1099
  //no code, no code
1100
- if(empty($code))
1101
- $error = __("No code was given to check.", "pmpro");
1102
-
1103
- //get code from db
1104
- if(!$error)
1105
  {
1106
- $dbcode = $wpdb->get_row("SELECT *, UNIX_TIMESTAMP(starts) as starts, UNIX_TIMESTAMP(expires) as expires FROM $wpdb->pmpro_discount_codes WHERE code ='" . $code . "' LIMIT 1");
1107
-
1108
- //did we find it?
1109
- if(empty($dbcode->id))
1110
- $error = __("The discount code could not be found.", "pmpro");
1111
  }
1112
-
1113
- //check if the code has started
1114
- if(!$error)
 
 
 
1115
  {
1116
- //fix the date timestamps
1117
- $dbcode->starts = strtotime(date("m/d/Y", $dbcode->starts));
1118
- $dbcode->expires = strtotime(date("m/d/Y", $dbcode->expires));
 
 
 
 
 
 
1119
 
1120
- //today
1121
- $today = strtotime(date("m/d/Y 00:00:00", current_time("timestamp")));
1122
 
1123
- //has this code started yet?
1124
- if(!empty($dbcode->starts) && $dbcode->starts > $today)
1125
- $error = sprintf(__("This discount code goes into effect on %s.", "pmpro"), date(get_option('date_format'), $dbcode->starts));
 
 
 
 
1126
  }
1127
 
1128
- //check if the code is expired
1129
- if(!$error)
1130
- {
1131
- if(!empty($dbcode->expires) && $dbcode->expires < $today)
1132
- $error = sprintf(__("This discount code expired on %s.", "pmpro"), date(get_option('date_format'), $dbcode->expires));
 
 
1133
  }
1134
 
1135
  //have we run out of uses?
1136
- if(!$error)
1137
  {
1138
- if($dbcode->uses > 0)
 
1139
  {
1140
- $used = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->pmpro_discount_codes_uses WHERE code_id = '" . $dbcode->id . "'");
1141
- if($used >= $dbcode->uses)
1142
- $error = __("This discount code is no longer valid.", "pmpro");
 
1143
  }
1144
  }
1145
 
1146
  //if a level was passed check if this code applies
1147
- if(!$error)
 
1148
  {
1149
- $pmpro_check_discount_code_levels = apply_filters("pmpro_check_discount_code_levels", true, $dbcode->id);
1150
- if(!empty($level_id) && $pmpro_check_discount_code_levels)
 
1151
  {
1152
- $code_level = $wpdb->get_row("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 WHERE cl.code_id = '" . $dbcode->id . "' AND cl.level_id = '" . $level_id . "' LIMIT 1");
1153
-
1154
- if(empty($code_level))
1155
- $error = __("This discount code does not apply to this membership level.", "pmpro");
1156
  }
1157
  }
1158
-
1159
- //allow filter
1160
- $pmpro_check_discount_code = apply_filters("pmpro_check_discount_code", !$error, $dbcode, $level_id, $code);
1161
- if(is_string($pmpro_check_discount_code))
1162
- $error = $pmpro_check_discount_code; //string returned, this is an error
1163
- elseif(!$pmpro_check_discount_code && !$error)
1164
- $error = true; //no error before, but filter returned error
1165
- elseif($pmpro_check_discount_code)
1166
- $error = false; //filter is true, so error false
1167
-
1168
- //return
1169
- if($error)
1170
- {
1171
- //there was an error
1172
- if(!empty($return_errors))
1173
- return array(false, $error);
1174
- else
1175
- return false;
1176
- }
1177
  else
1178
- {
1179
- //guess we're all good
1180
- if(!empty($return_errors))
1181
- return array(true, __("This discount code is okay.", "pmpro"));
1182
- else
1183
- return true;
1184
- }
1185
  }
1186
 
1187
  function pmpro_no_quotes($s, $quotes = array("'", '"'))
@@ -1203,7 +1183,7 @@ function pmpro_implodeToEnglish($array)
1203
  if (!count ($array))
1204
  return $last;
1205
 
1206
- return implode (', ', $array).' ' . __('and', 'pmpro') . ' '.$last;
1207
  }
1208
 
1209
  //from yoast wordpress seo
@@ -1353,7 +1333,7 @@ function pmpro_getLevel($level)
1353
  {
1354
  global $wpdb;
1355
  $level_obj = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE name = '" . $level . "' LIMIT 1");
1356
- $level_id = $level_obj->id;
1357
  $pmpro_levels[$level_id] = $level_obj;
1358
  return $pmpro_levels[$level_id];
1359
  }
@@ -1375,7 +1355,7 @@ function pmpro_getAllLevels($include_hidden = false, $force = false)
1375
  $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ";
1376
  if(!$include_hidden)
1377
  $sqlQuery .= " WHERE allow_signups = 1 ORDER BY id";
1378
-
1379
  //get levels from the DB
1380
  $raw_levels = $wpdb->get_results($sqlQuery);
1381
 
@@ -1392,7 +1372,7 @@ function pmpro_getAllLevels($include_hidden = false, $force = false)
1392
  function pmpro_getCheckoutButton($level_id, $button_text = NULL, $classes = NULL)
1393
  {
1394
  if(empty($button_text))
1395
- $button_text = __("Sign Up for !!name!! Now", "pmpro");
1396
 
1397
  if(empty($classes))
1398
  $classes = "btn btn-primary";
@@ -1521,16 +1501,10 @@ if(!function_exists("pmpro_getMemberDays"))
1521
  {
1522
  $startdate = pmpro_getMemberStartdate($user_id, $level_id);
1523
 
1524
- //check that there was a startdate at all
1525
- if(empty($startdate))
1526
- $pmpro_member_days[$user_id][$level_id] = 0;
1527
- else
1528
- {
1529
- $now = current_time('timestamp');
1530
- $days = ($now - $startdate)/3600/24;
1531
 
1532
- $pmpro_member_days[$user_id][$level_id] = $days;
1533
- }
1534
  }
1535
 
1536
  return $pmpro_member_days[$user_id][$level_id];
@@ -1739,4 +1713,4 @@ function pmpro_is_ready()
1739
  return true;
1740
  else
1741
  return false;
1742
- }
103
  {
104
  //no value is given, set v to the request var
105
  if($v === NULL && isset($_REQUEST[$s]))
106
+ $v = trim($_REQUEST[$s]);
107
 
108
  if(is_array($v))
109
  $v = implode(",", $v);
110
+
 
 
111
  return update_option("pmpro_" . $s, $v);
112
  }
113
 
199
  global $pmpro_currency_symbol;
200
  //initial payment
201
  if(!$short)
202
+ $r = sprintf(_x('The price for membership is <strong>%s</strong> now', 'Initial payment in cost text generation.', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2));
203
  else
204
+ $r = sprintf(_x('<strong>%s</strong> now', 'Shorter initial payment in cost text generation.', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2));
205
 
206
  //recurring part
207
  if($level->billing_amount != '0.00')
210
  {
211
  if($level->cycle_number == '1')
212
  {
213
+ $r .= sprintf(_x(' and then <strong>%s per %s for %d more %s</strong>.', 'Recurring payment in cost text generation. E.g. $5 every month for 2 more payments.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, pmpro_translate_billing_period($level->cycle_period), $level->billing_limit, pmpro_translate_billing_period($level->cycle_period, $level->billing_limit));
214
  }
215
  else
216
  {
217
+ $r .= sprintf(_x(' and then <strong>%s every %d %s for %d more %s</strong>.', 'Recurring payment in cost text generation. E.g., $5 every 2 months for 2 more payments.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number), $level->billing_limit, pmpro_translate_billing_period($level->cycle_period, $level->billing_limit));
218
  }
219
  }
220
  elseif($level->billing_limit == 1)
221
  {
222
+ $r .= sprintf(_x(' and then <strong>%s after %d %s</strong>.', 'Recurring payment in cost text generation. E.g. $5 after 2 months.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
223
  }
224
  else
225
  {
226
  if( $level->billing_amount === $level->initial_payment ) {
227
  if($level->cycle_number == '1')
228
  {
229
+ $r = sprintf(_x('The price for membership is <strong>%s per %s</strong>.', 'Initial payment in cost text generation, with recurrence.', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2), pmpro_translate_billing_period($level->cycle_period) );
230
  }
231
  else
232
  {
233
+ $r = sprintf(_x('The price for membership is <strong>%s every %d %s</strong>.', 'Initial payment in cost text generation, with recurrence.', 'pmpro'), $pmpro_currency_symbol . number_format($level->initial_payment, 2), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period) );
234
  }
235
  } else {
236
  if($level->cycle_number == '1')
237
  {
238
+ $r .= sprintf(_x(' and then <strong>%s per %s</strong>.', 'Recurring payment in cost text generation. E.g. $5 every month.', 'pmpro'), $pmpro_currency_symbol . $level->billing_amount, pmpro_translate_billing_period($level->cycle_period));
239
  }
240
  else
241
  {
242
+ $r .= sprintf(_x(' and then <strong>%s every %d %s</strong>.', 'Recurring payment in cost text generation. E.g., $5 every 2 months.', 'pmpro'), $pmpro_curr