Paid Memberships Pro - Version 1.7.10

Version Description

  • Added getGatewaySubscriptionStatus() and getGatewayTransactionStatus() methods to the MemberOrder class. These are implemented for PayPalExpress right now and will hit the gateway API to return information on a subscription or transaction.
  • Added pmpro_memberslist_expires_column filter to members list. $order is passed as second parameter. Use this to filter the date or "Never" shown in the Expires column.
  • No longer showing "Membership Levels" link in dashboard menu if a user has access to other PMPro settings pages, but not the membership levels page.
  • Added pmpro_applydiscountcode_return_js hook. http://www.paidmembershipspro.com/hook/pmpro_applydiscountcode_return_js/
  • Fixed formatting of the level cost when a discount code is applied via AJAX.
  • Removed extra $ in checkout_check.html email template.
  • Fixed bug where pmpro_setOption was not working for array values in $_POST, e.g. the hideadlevels setting on the Advanced Settings page.
  • pmpro_getMembershipCategories($level_id) now returns an array of category IDs instead of an array of arrays.
  • Swapped all x function calls to use _ or _e so they are translated.
  • Initial Czech Republic (cs_CZ) translation files. (Thanks, Petr Hlavek)
Download this release

Release Info

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

Code changes from version 1.7.14 to 1.7.10

Files changed (102) 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 +1 -1
  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.php +1 -1
  18. adminpages/orders-csv.php +8 -8
  19. adminpages/orders.php +11 -11
  20. adminpages/reports/login.php +1 -1
  21. adminpages/reports/memberships.php +1 -1
  22. classes/class.memberorder.php +4 -13
  23. classes/class.pmproemail.php +12 -15
  24. classes/gateways/class.pmprogateway.php +2 -2
  25. classes/gateways/class.pmprogateway_authorizenet.php +2 -2
  26. classes/gateways/class.pmprogateway_braintree.php +2 -2
  27. classes/gateways/class.pmprogateway_check.php +2 -2
  28. classes/gateways/class.pmprogateway_cybersource.php +5 -5
  29. classes/gateways/class.pmprogateway_payflowpro.php +9 -9
  30. classes/gateways/class.pmprogateway_paypal.php +2 -2
  31. classes/gateways/class.pmprogateway_paypalexpress.php +2 -2
  32. classes/gateways/class.pmprogateway_paypalstandard.php +6 -17
  33. classes/gateways/class.pmprogateway_stripe.php +16 -22
  34. includes/adminpages.php +3 -3
  35. includes/content.php +40 -67
  36. includes/email.php +9 -11
  37. includes/filters.php +2 -2
  38. includes/functions.php +68 -84
  39. includes/init.php +1 -30
  40. includes/login.php +2 -18
  41. includes/profile.php +4 -4
  42. includes/services.php +1 -1
  43. includes/upgradecheck.php +1 -13
  44. languages/email/da_DK/admin_change.html +0 -7
  45. languages/email/da_DK/admin_change_admin.html +0 -5
  46. languages/email/da_DK/billing.html +0 -16
  47. languages/email/da_DK/billing_admin.html +0 -17
  48. languages/email/da_DK/billing_failure.html +0 -11
  49. languages/email/da_DK/billing_failure_admin.html +0 -11
  50. languages/email/da_DK/cancel.html +0 -3
  51. languages/email/da_DK/cancel_admin.html +0 -8
  52. languages/email/da_DK/checkout_check.html +0 -17
  53. languages/email/da_DK/checkout_check_admin.html +0 -17
  54. languages/email/da_DK/checkout_express.html +0 -14
  55. languages/email/da_DK/checkout_express_admin.html +0 -14
  56. languages/email/da_DK/checkout_free.html +0 -8
  57. languages/email/da_DK/checkout_free_admin.html +0 -8
  58. languages/email/da_DK/checkout_freetrial.html +0 -19
  59. languages/email/da_DK/checkout_freetrial_admin.html +0 -19
  60. languages/email/da_DK/checkout_paid.html +0 -23
  61. languages/email/da_DK/checkout_paid_admin.html +0 -23
  62. languages/email/da_DK/checkout_trial.html +0 -23
  63. languages/email/da_DK/checkout_trial_admin.html +0 -23
  64. languages/email/da_DK/credit_card_expiring.html +0 -13
  65. languages/email/da_DK/default.html +0 -1
  66. languages/email/da_DK/footer.html +0 -4
  67. languages/email/da_DK/header.html +0 -1
  68. languages/email/da_DK/invoice.html +0 -19
  69. languages/email/da_DK/membership_expired.html +0 -7
  70. languages/email/da_DK/membership_expiring.html +0 -6
  71. languages/email/da_DK/trial_ending.html +0 -8
  72. languages/pmpro-da_DK.mo +0 -0
  73. languages/pmpro-da_DK.po +0 -3502
  74. languages/pmpro-fr_FR.mo +0 -0
  75. languages/pmpro-fr_FR.po +3 -4
  76. languages/pmpro-it_IT.mo +0 -0
  77. languages/pmpro-it_IT.po +77 -108
  78. languages/pmpro-nb_NO.mo +0 -0
  79. languages/pmpro-nb_NO.po +0 -3279
  80. languages/pmpro-tr_TR.mo +0 -0
  81. languages/pmpro-tr_TR.po +0 -3470
  82. languages/pmpro.mo +0 -0
  83. languages/pmpro.po +198 -308
  84. languages/pmpro.pot +198 -308
  85. pages/checkout.php +2 -6
  86. pages/confirmation.php +1 -1
  87. pages/levels.php +2 -2
  88. paid-memberships-pro.php +6 -6
  89. preheaders/account.php +42 -37
  90. preheaders/billing.php +400 -372
  91. preheaders/cancel.php +40 -39
  92. preheaders/checkout.php +1090 -999
  93. preheaders/confirmation.php +12 -15
  94. preheaders/invoice.php +32 -32
  95. preheaders/levels.php +33 -32
  96. readme.txt +2 -48
  97. scheduled/crons.php +3 -3
  98. services/applydiscountcode.php +1 -1
  99. services/getfile.php +57 -5
  100. services/ipnhandler.php +15 -23
  101. services/twocheckout-ins.php +8 -12
  102. 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,7 +5,7 @@
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
)
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('pmprosed_pmpro_checkout_level')
11
)
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.php CHANGED
@@ -203,7 +203,7 @@
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)
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)
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/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");
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");
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();
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();
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);
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);
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";
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";
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
@@ -205,7 +194,7 @@
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;
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
194
//redirect to paypal
195
$paypal_url .= $nvpStr;
196
197
+ //die($paypal_url);
198
199
wp_redirect($paypal_url);
200
exit;
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
{
includes/adminpages.php CHANGED
@@ -61,8 +61,8 @@ function pmpro_add_pages()
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
{
@@ -223,4 +223,4 @@ function pmpro_addons()
223
function pmpro_orders()
224
{
225
require_once(PMPRO_DIR . "/adminpages/orders.php");
226
- }
61
{
62
if(current_user_can("pmpro_membershiplevels"))
63
{
64
+ $submenu['pmpro-membershiplevels'][0][0] = "Membership Levels";
65
+ $submenu['pmpro-membershiplevels'][0][3] = "Membership Levels";
66
}
67
else
68
{
223
function pmpro_orders()
224
{
225
require_once(PMPRO_DIR . "/adminpages/orders.php");
226
+ }
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
@@ -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
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
@@ -232,7 +232,7 @@ function pmpro_getLevelCost(&$level, $tags = true, $short = false)
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')
@@ -577,7 +577,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 +605,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
@@ -648,7 +648,7 @@ function pmpro_changeMembershipLevel($level, $user_id = NULL)
648
'0',
649
'0',
650
'0',
651
- '" . current_time('mysql') . "',
652
'0000-00-00 00:00:00'
653
)";
654
@@ -830,7 +830,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 +1078,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 +1093,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("'", '"'))
@@ -1353,7 +1343,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 +1365,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
@@ -1521,16 +1511,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];
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) );
236
}
237
} else {
238
if($level->cycle_number == '1')
577
if(!empty($old_levels))
578
{
579
foreach($old_levels as $old_level) {
580
+ $sql = "UPDATE $wpdb->pmpro_memberships_users SET `status`='inactive', `enddate`=NOW() 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
if(is_array($level))
606
{
607
//make sure the dates are in good formats
608
+ if($level['startdate'] != "NOW()" && $level['startdate'] != "NULL" && substr($level['startdate'], 0, 1) != "'")
609
$level['startdate'] = "'" . $level['startdate'] . "'";
610
611
+ if($level['enddate'] != "NOW()" && $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
648
'0',
649
'0',
650
'0',
651
+ NOW(),
652
'0000-00-00 00:00:00'
653
)";
654
830
global $wpdb;
831
832
$results = $wpdb->get_results($query);
833
foreach($results as $result)
834
{
835
$r->{$result->key} = $result->value;
1078
1079
while(empty($code))
1080
{
1081
+ $scramble = md5(AUTH_KEY . time() . $seed . SECURE_AUTH_KEY);
1082
$code = substr($scramble, 0, 10);
1083
$check = $wpdb->get_var("SELECT code FROM $wpdb->pmpro_discount_codes WHERE code = '$code' LIMIT 1");
1084
if($check || is_numeric($code))
1093
{
1094
global $wpdb;
1095
1096
//no code, no code
1097
+ if(empty($code))
1098
{
1099
+ if($return_errors)
1100
+ return array(false, "No code was given to check.");
1101
+ else
1102
+ return false;
1103
}
1104
+
1105
+ //get code from db
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
{
1111
+ if($return_errors)
1112
+ return array(false, __("The discount code could not be found.", "pmpro"));
1113
+ else
1114
+ return false;
1115
+ }
1116
+
1117
+ //fix the date timestamps
1118
+ $dbcode->starts = strtotime(date("m/d/Y", $dbcode->starts));
1119
+ $dbcode->expires = strtotime(date("m/d/Y", $dbcode->expires));
1120
1121
+ //today
1122
+ $today = strtotime(date("m/d/Y 00:00:00"));
1123
1124
+ //has this code started yet?
1125
+ if(!empty($dbcode->starts) && $dbcode->starts > $today)
1126
+ {
1127
+ if($return_errors)
1128
+ return array(false, sprintf(__("This discount code goes into effect on %s.", "pmpro"), date(get_option('date_format'), $dbcode->starts)));
1129
+ else
1130
+ return false;
1131
}
1132
1133
+ //has this code expired?
1134
+ if(!empty($dbcode->expires) && $dbcode->expires < $today)
1135
+ {
1136
+ if($return_errors)
1137
+ return array(false, sprintf(__("This discount code expired on %s.", "pmpro"), date(get_option('date_format'), $dbcode->expires)));
1138
+ else
1139
+ return false;
1140
}
1141
1142
//have we run out of uses?
1143
+ if($dbcode->uses > 0)
1144
{
1145
+ $used = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->pmpro_discount_codes_uses WHERE code_id = '" . $dbcode->id . "'");
1146
+ if($used >= $dbcode->uses)
1147
{
1148
+ if($return_errors)
1149
+ return array(false, __("This discount code is no longer valid.", "pmpro"));
1150
+ else
1151
+ return false;
1152
}
1153
}
1154
1155
//if a level was passed check if this code applies
1156
+ $pmpro_check_discount_code_levels = apply_filters("pmpro_check_discount_code_levels", true, $dbcode->id);
1157
+ if(!empty($level_id) && $pmpro_check_discount_code_levels)
1158
{
1159
+ $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");
1160
+
1161
+ if(empty($code_level))
1162
{
1163
+ if(!empty($return_errors))
1164
+ return array(false, __("This discount code does not apply to this membership level.", "pmpro"));
1165
+ else
1166
+ return false;
1167
}
1168
}
1169
+
1170
+ //guess we're all good
1171
+ if(!empty($return_errors))
1172
+ return array(true, __("This discount code is okay.", "pmpro"));
1173
else
1174
+ return true;
1175
}
1176
1177
function pmpro_no_quotes($s, $quotes = array("'", '"'))
1343
{
1344
global $wpdb;
1345
$level_obj = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE name = '" . $level . "' LIMIT 1");
1346
+ $level_id = $level->ID;
1347
$pmpro_levels[$level_id] = $level_obj;
1348
return $pmpro_levels[$level_id];
1349
}
1365
$sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ";
1366
if(!$include_hidden)
1367
$sqlQuery .= " WHERE allow_signups = 1 ORDER BY id";
1368
+
1369
//get levels from the DB
1370
$raw_levels = $wpdb->get_results($sqlQuery);
1371
1511
{
1512
$startdate = pmpro_getMemberStartdate($user_id, $level_id);
1513
1514
+ $now = time();
1515
+ $days = ($now - $startdate)/3600/24;
1516
1517
+ $pmpro_member_days[$user_id][$level_id] = $days;
1518
}
1519
1520
return $pmpro_member_days[$user_id][$level_id];
includes/init.php CHANGED
@@ -208,33 +208,4 @@ function pmpro_set_current_user()
208
209
do_action("pmpro_after_set_current_user");
210
}
211
- add_action('set_current_user', 'pmpro_set_current_user');
212
- add_action('init', 'pmpro_set_current_user');
213
-
214
- /*
215
- * Add Membership Level to Users page in WordPress dashboard.
216
- */
217
- function pmpro_manage_users_columns($columns) {
218
- $columns['pmpro_membership_level'] = __('Membership Level', 'pmpro');
219
- return $columns;
220
- }
221
-
222
- function pmpro_manage_users_custom_column($column_data, $column_name, $user_id) {
223
-
224
- if($column_name == 'pmpro_membership_level') {
225
- $levels = pmpro_getMembershipLevelsForUser($user_id);
226
- $level_names = array();
227
- if(!empty($levels)) {
228
- foreach($levels as $key => $level)
229
- $level_names[] = $level->name;
230
- $column_data = implode(',', $level_names);
231
- }
232
- else
233
- $column_data = __('None', 'pmpro');
234
- }
235
- return $column_data;
236
- }
237
-
238
- add_filter('manage_users_columns', 'pmpro_manage_users_columns');
239
- add_filter('manage_users_custom_column', 'pmpro_manage_users_custom_column', 10, 3);
240
-
208
209
do_action("pmpro_after_set_current_user");
210
}
211
+ add_action('set_current_user', 'pmpro_set_current_user');
includes/login.php CHANGED
@@ -54,7 +54,7 @@ add_filter('wp_signup_location', 'pmpro_wp_signup_location');
54
55
//redirect from default login pages to PMPro
56
function pmpro_login_head()
57
- {
58
$login_redirect = apply_filters("pmpro_login_redirect", true);
59
60
if((pmpro_is_login_page() || is_page("login") ||
@@ -139,20 +139,4 @@ function pmpro_login_head()
139
}
140
}
141
add_action('wp', 'pmpro_login_head');
142
- add_action('login_init', 'pmpro_login_head');
143
-
144
- /*
145
- If a redirect_to value is passed into /login/ and you are logged in already, just redirect there
146
-
147
- @since 1.7.14
148
- */
149
- function pmpro_redirect_to_logged_in()
150
- {
151
- if((pmpro_is_login_page() || is_page("login")) && !empty($_REQUEST['redirect_to']) && is_user_logged_in())
152
- {
153
- wp_redirect($_REQUEST['redirect_to']);
154
- exit;
155
- }
156
- }
157
- add_action("template_redirect", "pmpro_redirect_to_logged_in", 5);
158
- add_action("login_init", "pmpro_redirect_to_logged_in", 5);
54
55
//redirect from default login pages to PMPro
56
function pmpro_login_head()
57
+ {
58
$login_redirect = apply_filters("pmpro_login_redirect", true);
59
60
if((pmpro_is_login_page() || is_page("login") ||
139
}
140
}
141
add_action('wp', 'pmpro_login_head');
142
+ add_action('login_init', 'pmpro_login_head');
includes/profile.php CHANGED
@@ -130,7 +130,7 @@ function pmpro_membership_level_profile_fields($user)
130
for($i = 1; $i < 13; $i++)
131
{
132
?>
133
- <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>
134
<?php
135
}
136
?>
@@ -183,8 +183,8 @@ function pmpro_membership_level_profile_fields_update()
183
if(!empty($_REQUEST['expires']))
184
{
185
//update the expiration date
186
- $expiration_date = intval($_REQUEST['expires_year']) . "-" . str_pad(intval($_REQUEST['expires_month']), 2, "0", STR_PAD_LEFT) . "-" . str_pad(intval($_REQUEST['expires_day']), 2, "0", STR_PAD_LEFT);
187
- $sqlQuery = "UPDATE $wpdb->pmpro_memberships_users SET enddate = '" . $expiration_date . "' WHERE status = 'active' AND membership_id = '" . intval($_REQUEST['membership_level']) . "' AND user_id = '" . $user_ID . "' LIMIT 1";
188
if($wpdb->query($sqlQuery))
189
$expiration_changed = true;
190
}
@@ -197,7 +197,7 @@ function pmpro_membership_level_profile_fields_update()
197
if(empty($blank))
198
{
199
//null out the expiration
200
- $sqlQuery = "UPDATE $wpdb->pmpro_memberships_users SET enddate = NULL WHERE status = 'active' AND membership_id = '" . intval($_REQUEST['membership_level']) . "' AND user_id = '" . $user_ID . "' LIMIT 1";
201
if($wpdb->query($sqlQuery))
202
$expiration_changed = true;
203
}
130
for($i = 1; $i < 13; $i++)
131
{
132
?>
133
+ <option value="<?php echo $i?>" <?php if($i == $selected_expires_month) { ?>selected="selected"<?php } ?>><?php echo date("M", strtotime($i . "/1/" . $current_year))?></option>
134
<?php
135
}
136
?>
183
if(!empty($_REQUEST['expires']))
184
{
185
//update the expiration date
186
+ $expiration_date = intval($_REQUEST['expires_year']) . "-" . intval($_REQUEST['expires_month']) . "-" . intval($_REQUEST['expires_day']);
187
+ $sqlQuery = "UPDATE $wpdb->pmpro_memberships_users SET enddate = '" . $expiration_date . "' WHERE status = 'active' AND user_id = '" . $user_ID . "' LIMIT 1";
188
if($wpdb->query($sqlQuery))
189
$expiration_changed = true;
190
}
197
if(empty($blank))
198
{
199
//null out the expiration
200
+ $sqlQuery = "UPDATE $wpdb->pmpro_memberships_users SET enddate = NULL WHERE status = 'active' AND user_id = '" . $user_ID . "' LIMIT 1";
201
if($wpdb->query($sqlQuery))
202
$expiration_changed = true;
203
}
includes/services.php CHANGED
@@ -12,7 +12,7 @@ if(isset($_REQUEST['action']) && $_REQUEST['action'] == "applydiscountcode")
12
require_once(dirname(__FILE__) . "/../services/applydiscountcode.php");
13
exit;
14
}
15
- add_action("init", "pmpro_applydiscountcode_init", 11);
16
}
17
function pmpro_wp_ajax_authnet_silent_post()
18
{
12
require_once(dirname(__FILE__) . "/../services/applydiscountcode.php");
13
exit;
14
}
15
+ add_action("init", "pmpro_applydiscountcode_init");
16
}
17
function pmpro_wp_ajax_authnet_silent_post()
18
{
includes/upgradecheck.php CHANGED
@@ -73,7 +73,7 @@ function pmpro_checkForUpgrades()
73
if($pmpro_db_version < 1.72)
74
{
75
//schedule the credit card expiring cron
76
- wp_schedule_event(current_time('timestamp'), 'monthly', 'pmpro_cron_credit_card_expiring_warnings');
77
78
pmpro_setOption("db_version", "1.72");
79
$pmpro_db_version = 1.72;
@@ -93,18 +93,6 @@ function pmpro_checkForUpgrades()
93
pmpro_setOption("db_version", "1.79");
94
$pmpro_db_version = 1.79;
95
}
96
-
97
- //set default filter_queries setting
98
- if($pmpro_db_version < 1.791)
99
- {
100
- if(!pmpro_getOption("showexcerpts"))
101
- pmpro_setOption("filterqueries", 1);
102
- else
103
- pmpro_SetOption("filterqueries", 0);
104
-
105
- pmpro_setOption("db_version", "1.791");
106
- $pmpro_db_version = 1.791;
107
- }
108
}
109
110
function pmpro_upgrade_1_7()
73
if($pmpro_db_version < 1.72)
74
{
75
//schedule the credit card expiring cron
76
+ wp_schedule_event(time(), 'monthly', 'pmpro_cron_credit_card_expiring_warnings');
77
78
pmpro_setOption("db_version", "1.72");
79
$pmpro_db_version = 1.72;
93
pmpro_setOption("db_version", "1.79");
94
$pmpro_db_version = 1.79;
95
}
96
}
97
98
function pmpro_upgrade_1_7()
languages/email/da_DK/admin_change.html DELETED
@@ -1,7 +0,0 @@
1
- <p>En Administrator hos !!sitename!! har ændret dit medlemsskab niveau.</p>
2
-
3
- <p>!!membership_change!!.</p>
4
-
5
- <p>Hvis du ikke har bedt om, at få dit medlemsskab ændret, og gerne ville vide mere omkring det, kontakt os venligst på denne mail !!siteemail!!</p>
6
-
7
- <p>Log ind på din konto her: !!login_link!!</p>
languages/email/da_DK/admin_change_admin.html DELETED
@@ -1,5 +0,0 @@
1
- <p>En Administrator hos !!sitename!! har ændret medlemsskab niveau.</p>
2
-
3
- <p>!!membership_change!!.</p>
4
-
5
- <p>Log ind på din Wordpress admin her: !!login_link!!</p>
languages/email/da_DK/billing.html DELETED
@@ -1,16 +0,0 @@
1
- <p>Din betaings informationer hos !!sitename!! er bleven ændret.</p>
2
-
3
- <p>Konto: !!display_name!! (!!user_email!!)</p>
4
- <p>
5
- Betalings Informationer:<br />
6
- !!billing_address!!
7
- </p>
8
-
9
- <p>
10
- !!cardtype!!: !!accountnumber!!<br />
11
- Udløber: !!expirationmonth!!/!!expirationyear!!
12
- </p>
13
-
14
- <p>Hvis du ikke har bedt om, at ændre betalings informationer, så kontakt os via !!siteemail!!</p>
15
-
16
- <p>Log ind til din medlems konto her: !!login_link!!</p>
languages/email/da_DK/billing_admin.html DELETED
@@ -1,17 +0,0 @@
1
- <p>Betalings informationer for !!display_name!! hos !!sitename!! er bleven ændret.</p>
2
-
3
- <p>Konto: !!display_name!! (!!user_email!!)</p>
4
- <p>
5
- Betalings informationer:<br />
6
- !!billing_name!!<br />
7
- !!billing_street!!<br />
8
- !!billing_city!!, !!billing_state!! !!billing_zip!! !!billing_country!!
9
- !!billing_phone!!
10
- </p>
11
-
12
- <p>
13
- !!cardtype!!: !!accountnumber!!<br />
14
- Udløber: !!expirationmonth!!/!!expirationyear!!
15
- </p>
16
-
17
- <p>Log ind på din Wordpress kontrolpanel her: !!login_link!!</p>
languages/email/da_DK/billing_failure.html DELETED
@@ -1,11 +0,0 @@
1
- <p>Den nuværende abonnements betaling for dit !!sitename!! medlemsskab har fejlet. <strong>Klik på følgende link for at logge ind og opdatere dine betalings informationer for at undgå at din konto blive deaktiveret. !!login_link!!</strong></p>
2
-
3
- <p>Konto: !!display_name!! (!!user_email!!)</p>
4
- <p>De seneste konto informationer vi på arkiv er:</p>
5
-
6
- <p>!!billing_address!!</p>
7
-
8
- <p>
9
- !!cardtype!!: !!accountnumber!!<br />
10
- Udløber: !!expirationmonth!!/!!expirationyear!!
11
- </p>
languages/email/da_DK/billing_failure_admin.html DELETED
@@ -1,11 +0,0 @@
1
- <p>Betaling Fejlet</p>
2
-
3
- <p>Konto: !!display_name!! (!!user_email!!)</p>
4
- <p>De seneste konto informationer vi på arkiv er:</p>
5
-
6
- <p>!!billing_address!!</p>
7
-
8
- <p>
9
- !!cardtype!!: !!accountnumber!!<br />
10
- Udløber: !!expirationmonth!!/!!expirationyear!!
11
- </p>
languages/email/da_DK/cancel.html DELETED
@@ -1,3 +0,0 @@
1
- <p>Dit medlemsskab hos !!sitename!! er bleven annulleret.</p>
2
-
3
- <p>Hvis du ikke har anmodet om at denne annullering, og ville vide mere omkring det. Kontakt os via !!siteemail!!</p>
languages/email/da_DK/cancel_admin.html DELETED
@@ -1,8 +0,0 @@
1
- <p>Medlemsskabet for !!user_login!! hos !!sitename!! er bleven annulleret.</p>
2
-
3
- <p>Konto: !!display_name!! (!!user_email!!)</p>
4
- <p>Medlemsskab Niveau: !!membership_level_name!!</p>
5
- <p>Start Dato: !!startdate!!</p>
6
- <p>Annullering Dato: !!enddate!!</p>
7
-
8
- <p>Log ind på din Wordpress admin her: !!login_link!!</p>
languages/email/da_DK/checkout_check.html DELETED
@@ -1,17 +0,0 @@
1
- <p>Tak for din bestilling til !!sitename!!. Dit medlemsskab er nu aktiveret.</p>
2
-
3
- !!instructions!!
4
-
5
- <p>Nedenfor er detaljerne omkring dit nye medlemsskab og en faktura.</p>
6
-
7
- <p>Konto: !!display_name!! (!!user_email!!)</p>
8
- <p>Medlemsskabs Niveau: !!membership_level_name!!</p>
9
- <p>Medlemsskabs Gebyr: !!membership_cost!!</p>
10
- !!membership_expiration!! !!discount_code!!
11
-
12
- <p>
13
- Faktura #!!invoice_id!! on !!invoice_date!!<br />
14
- Regning Total: !!invoice_total!!
15
- </p>
16
-
17
- <p>Log ind på din konto her: !!login_link!!</p>
languages/email/da_DK/checkout_check_admin.html DELETED
@@ -1,17 +0,0 @@
1
- <p>Der er kommet et nyt medlem hos !!sitename!!.</p>
2
-
3
- <p><strong>De har valgt at betale med check.</strong></p>
4
-
5
- <p>Nedenfor er detaljer omkring det nye medlems konto og en forklaring på medlemmets faktura.</p>
6
-
7
- <p>Konto: !!display_name!! (!!user_email!!)</p>
8
- <p>Meldlemsskab Niveau: !!membership_level_name!!</p>
9
- <p>Medlemsskab Gebyr: !!membership_cost!!</p>
10
- !!membership_expiration!! !!discount_code!!
11
-
12
- <p>
13
- Faktura #!!invoice_id!! on !!invoice_date!!<br />
14
- Regning Total: $!!invoice_total!!
15
- </p>
16
-
17
- <p>Log ind på din konto her: !!login_link!!</p>
languages/email/da_DK/checkout_express.html DELETED
@@ -1,14 +0,0 @@
1
- <p>Tak for din bestilling til !!sitename!!. Dit medlemsskab er nu aktiveret.</p>
2
- <p>Nedenfor er detaljerne omkring dit nye medlemsskab og en faktura.</p>
3
-
4
- <p>Konto: !!display_name!! (!!user_email!!)</p>
5
- <p>Medlemsskabs Niveau: !!membership_level_name!!</p>
6
- <p>Medlemsskabs Gebyr: !!membership_cost!!</p>
7
- !!membership_expiration!! !!discount_code!!
8
-
9
- <p>
10
- Faktura #!!invoice_id!! on !!invoice_date!!<br />
11
- Regning Total: !!invoice_total!!
12
- </p>
13
-
14
- <p>Log ind på din konto her: !!login_link!!</p>
languages/email/da_DK/checkout_express_admin.html DELETED
@@ -1,14 +0,0 @@
1
- <p>Der er kommet et nyt medlem hos !!sitename!!.</p>
2
- <p>Nedenfor er detaljer omkring det nye medlems konto og en forklaring på medlemmets faktura.</p>
3
-
4
- <p>Konto: !!display_name!! (!!user_email!!)</p>
5
- <p>Medlemsskab Nivea: !!membership_level_name!!</p>
6
- <p>Medlemsskab Gebyr: !!membership_cost!!</p>
7
- !!membership_expiration!! !!discount_code!!
8
-
9
- <p>
10
- Faktura #!!invoice_id!! on !!invoice_date!!<br />
11
- Regning Total: !!invoice_total!!
12
- </p>
13
-
14
- <p>Log ind på din konto her: !!login_link!!</p>
languages/email/da_DK/checkout_free.html DELETED
@@ -1,8 +0,0 @@
1
- <p>Tak for din bestilling til !!sitename!!. Dit medlemsskab er nu aktiveret.</p>
2
- <p>Nedenfor er detaljerne omkring dit nye medlemsskab.</p>
3
-
4
- <p>Konto: !!display_name!! (!!user_email!!)</p>
5
- <p>Medlemsskabs Niveau: !!membership_level_name!!</p>
6
- !!membership_expiration!! !!discount_code!!
7
-
8
- <p>Log ind på din konto her: !!login_link!!</p>
languages/email/da_DK/checkout_free_admin.html DELETED
@@ -1,8 +0,0 @@
1
- <p>Der er kommet et nyt medlem hos !!sitename!!.</p>
2
- <p>Nedenfor er detaljerne omkring det nye medlemsskabs konto.</p>
3
-
4
- <p>Konto: !!display_name!! (!!user_email!!)</p>
5
- <p>Medlemsskabs Niveau: !!membership_level_name!!</p>
6
- !!membership_expiration!! !!discount_code!!
7
-
8
- <p>Log ind på din konto her: !!login_link!!</p>
languages/email/da_DK/checkout_freetrial.html DELETED
@@ -1,19 +0,0 @@
1
- <p>Tak for din bestilling til !!sitename!!. Dit medlemsskab er nu aktive