Paid Memberships Pro - Version 1.7.0.3

Version Description

  • Fixed a performance issue added in 1.7.0.2.
Download this release

Release Info

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

Code changes from version 1.7.14 to 1.7.0.3

Files changed (177) hide show
  1. adminpages/addons.php +1 -1
  2. adminpages/addons/images/pmpro-aweber.gif +0 -0
  3. adminpages/addons/images/pmpro-bbpress.jpg +0 -0
  4. adminpages/addons/images/pmpro-constant-contact.gif +0 -0
  5. adminpages/addons/images/pmpro-email-templates.gif +0 -0
  6. adminpages/addons/images/pmpro-woocommerce.gif +0 -0
  7. adminpages/addons/pmpro-addon-packages.php +2 -2
  8. adminpages/addons/pmpro-affiliates.php +2 -2
  9. adminpages/addons/pmpro-aweber.php +0 -31
  10. adminpages/addons/pmpro-bbpress.php +6 -9
  11. adminpages/addons/pmpro-constant-contact.php +0 -31
  12. adminpages/addons/pmpro-email-templates.php +0 -31
  13. adminpages/addons/pmpro-expiration.php +8 -10
  14. adminpages/addons/pmpro-freeaddress.php +5 -7
  15. adminpages/addons/pmpro-infusionsoft.php +4 -4
  16. adminpages/addons/pmpro-international-addresses.php +0 -31
  17. adminpages/addons/pmpro-mailchimp.php +4 -4
  18. adminpages/addons/pmpro-network-subsite.php +0 -31
  19. adminpages/addons/pmpro-network.php +1 -1
  20. adminpages/addons/pmpro-post-affiliate-pro.php +1 -1
  21. adminpages/addons/pmpro-register-helper.php +1 -1
  22. adminpages/addons/pmpro-series.php +1 -1
  23. adminpages/addons/pmpro-shipping.php +0 -31
  24. adminpages/addons/pmpro-stripe-lite.php +30 -0
  25. adminpages/addons/pmpro-user-pages.php +2 -2
  26. adminpages/addons/pmpro-woocommerce.php +0 -31
  27. adminpages/addons/pmpro-wp-affiliate.php +3 -5
  28. adminpages/addons/tml.php +1 -1
  29. adminpages/addons/wp-bouncer.php +4 -4
  30. adminpages/admin_header.php +1 -22
  31. adminpages/advancedsettings.php +12 -96
  32. adminpages/dashboard.php +2 -2
  33. adminpages/discountcodes.php +631 -636
  34. adminpages/emailsettings.php +152 -181
  35. adminpages/functions.php +6 -71
  36. adminpages/membershiplevels.php +580 -588
  37. adminpages/memberslist-csv.php +36 -105
  38. adminpages/memberslist.php +30 -58
  39. adminpages/orders-csv.php +23 -135
  40. adminpages/orders.php +13 -318
  41. adminpages/pagesettings.php +9 -51
  42. adminpages/paymentsettings.php +491 -538
  43. adminpages/reports.php +41 -54
  44. adminpages/reports/login.php +50 -50
  45. adminpages/reports/memberships.php +0 -651
  46. adminpages/reports/sales.php +0 -397
  47. classes/class.memberorder.php +46 -106
  48. classes/class.pmproemail.php +24 -141
  49. classes/gateways/class.pmprogateway.php +2 -21
  50. classes/gateways/class.pmprogateway_authorizenet.php +4 -3
  51. classes/gateways/class.pmprogateway_braintree.php +14 -13
  52. classes/gateways/class.pmprogateway_check.php +2 -2
  53. classes/gateways/class.pmprogateway_cybersource.php +0 -765
  54. classes/gateways/class.pmprogateway_payflowpro.php +20 -19
  55. classes/gateways/class.pmprogateway_paypal.php +12 -13
  56. classes/gateways/class.pmprogateway_paypalexpress.php +24 -69
  57. classes/gateways/class.pmprogateway_paypalstandard.php +17 -36
  58. classes/gateways/class.pmprogateway_stripe.php +33 -82
  59. classes/gateways/class.pmprogateway_twocheckout.php +0 -145
  60. css/admin-rtl.css +0 -63
  61. css/admin.css +5 -6
  62. css/frontend-rtl.css +0 -111
  63. css/frontend.css +118 -173
  64. email/admin_change.html +1 -1
  65. email/billing.html +4 -1
  66. email/billing_failure.html +5 -1
  67. email/billing_failure_admin.html +5 -1
  68. email/checkout_check.html +1 -1
  69. email/checkout_express.html +2 -2
  70. email/checkout_express_admin.html +2 -2
  71. email/checkout_freetrial.html +4 -1
  72. email/checkout_freetrial_admin.html +4 -1
  73. email/checkout_paid.html +4 -1
  74. email/checkout_paid_admin.html +4 -1
  75. email/checkout_trial.html +4 -1
  76. email/checkout_trial_admin.html +4 -1
  77. email/credit_card_expiring.html +0 -13
  78. email/invoice.html +6 -2
  79. includes/adminpages.php +66 -147
  80. includes/cleanup.php +12 -1
  81. includes/content.php +39 -74
  82. includes/currencies.php +2 -9
  83. includes/email.php +31 -58
  84. includes/filters.php +3 -41
  85. includes/functions.php +1605 -1742
  86. includes/https.php +19 -54
  87. includes/init.php +29 -94
  88. includes/lib/CyberSource/cyber_source_soap_client.php +0 -87
  89. includes/lib/Stripe/Stripe.php +0 -10
  90. includes/lib/Stripe/Stripe/Account.php +6 -5
  91. includes/lib/Stripe/Stripe/ApiRequestor.php +51 -153
  92. includes/lib/Stripe/Stripe/ApiResource.php +17 -51
  93. includes/lib/Stripe/Stripe/ApplicationFee.php +0 -53
  94. includes/lib/Stripe/Stripe/AttachedObject.php +0 -23
  95. includes/lib/Stripe/Stripe/Balance.php +0 -15
  96. includes/lib/Stripe/Stripe/BalanceTransaction.php +0 -39
  97. includes/lib/Stripe/Stripe/Card.php +0 -54
  98. includes/lib/Stripe/Stripe/CardError.php +2 -4
  99. includes/lib/Stripe/Stripe/Charge.php +7 -55
  100. includes/lib/Stripe/Stripe/Coupon.php +7 -24
  101. includes/lib/Stripe/Stripe/Customer.php +6 -61
  102. includes/lib/Stripe/Stripe/Error.php +7 -9
  103. includes/lib/Stripe/Stripe/Event.php +6 -12
  104. includes/lib/Stripe/Stripe/InvalidRequestError.php +2 -4
  105. includes/lib/Stripe/Stripe/Invoice.php +6 -30
  106. includes/lib/Stripe/Stripe/InvoiceItem.php +6 -24
  107. includes/lib/Stripe/Stripe/List.php +5 -25
  108. includes/lib/Stripe/Stripe/Object.php +12 -123
  109. includes/lib/Stripe/Stripe/Plan.php +6 -26
  110. includes/lib/Stripe/Stripe/Recipient.php +0 -75
  111. includes/lib/Stripe/Stripe/SingletonApiResource.php +0 -7
  112. includes/lib/Stripe/Stripe/Stripe.php +3 -49
  113. includes/lib/Stripe/Stripe/Subscription.php +0 -58
  114. includes/lib/Stripe/Stripe/Token.php +6 -12
  115. includes/lib/Stripe/Stripe/Transfer.php +6 -34
  116. includes/lib/Stripe/Stripe/Util.php +14 -42
  117. includes/lib/Twocheckout/Twocheckout.php +0 -31
  118. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutAccount.php +0 -25
  119. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutApi.php +0 -33
  120. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutCoupon.php +0 -42
  121. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutError.php +0 -14
  122. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutOption.php +0 -42
  123. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutPayment.php +0 -24
  124. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutProduct.php +0 -42
  125. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutSale.php +0 -104
  126. includes/lib/Twocheckout/Twocheckout/Api/TwocheckoutUtil.php +0 -72
  127. includes/lib/Twocheckout/Twocheckout/TwocheckoutCharge.php +0 -61
  128. includes/lib/Twocheckout/Twocheckout/TwocheckoutMessage.php +0 -13
  129. includes/lib/Twocheckout/Twocheckout/TwocheckoutNotification.php +0 -20
  130. includes/lib/Twocheckout/Twocheckout/TwocheckoutReturn.php +0 -21
  131. includes/localization.php +4 -4
  132. includes/login.php +8 -32
  133. includes/metaboxes.php +2 -2
  134. includes/notifications.php +3 -9
  135. includes/profile.php +6 -9
  136. includes/recaptcha.php +10 -18
  137. includes/services.php +1 -8
  138. includes/setup.sql +6 -11
  139. includes/upgradecheck.php +39 -80
  140. includes/xmlrpc.php +0 -80
  141. languages/email/da_DK/admin_change.html +0 -7
  142. languages/email/da_DK/admin_change_admin.html +0 -5
  143. languages/email/da_DK/billing.html +0 -16
  144. languages/email/da_DK/billing_admin.html +0 -17
  145. languages/email/da_DK/billing_failure.html +0 -11
  146. languages/email/da_DK/billing_failure_admin.html +0 -11
  147. languages/email/da_DK/cancel.html +0 -3
  148. languages/email/da_DK/cancel_admin.html +0 -8
  149. languages/email/da_DK/checkout_check.html +0 -17
  150. languages/email/da_DK/checkout_check_admin.html +0 -17
  151. languages/email/da_DK/checkout_express.html +0 -14
  152. languages/email/da_DK/checkout_express_admin.html +0 -14
  153. languages/email/da_DK/checkout_free.html +0 -8
  154. languages/email/da_DK/checkout_free_admin.html +0 -8
  155. languages/email/da_DK/checkout_freetrial.html +0 -19
  156. languages/email/da_DK/checkout_freetrial_admin.html +0 -19
  157. languages/email/da_DK/checkout_paid.html +0 -23
  158. languages/email/da_DK/checkout_paid_admin.html +0 -23
  159. languages/email/da_DK/checkout_trial.html +0 -23
  160. languages/email/da_DK/checkout_trial_admin.html +0 -23
  161. languages/email/da_DK/credit_card_expiring.html +0 -13
  162. languages/email/da_DK/default.html +0 -1
  163. languages/email/da_DK/footer.html +0 -4
  164. languages/email/da_DK/header.html +0 -1
  165. languages/email/da_DK/invoice.html +0 -19
  166. languages/email/da_DK/membership_expired.html +0 -7
  167. languages/email/da_DK/membership_expiring.html +0 -6
  168. languages/email/da_DK/trial_ending.html +0 -8
  169. languages/gettext.sh +0 -23
  170. languages/pmpro-cs_CZ.mo +0 -0
  171. languages/pmpro-cs_CZ.po +0 -2889
  172. languages/pmpro-da_DK.mo +0 -0
  173. languages/pmpro-da_DK.po +0 -3502
  174. languages/pmpro-en_GB.mo +0 -0
  175. languages/pmpro-en_GB.po +0 -2661
  176. languages/pmpro-es_CL.mo +0 -0
  177. languages/pmpro-es_CL.po +0 -790
adminpages/addons.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  //only admins can get this
3
- if(!function_exists("current_user_can") || (!current_user_can("manage_options") && !current_user_can("pmpro_addons")))
4
  {
5
  die(__("You do not have permissions to perform this action.", "pmpro"));
6
  }
1
  <?php
2
  //only admins can get this
3
+ if(!function_exists("current_user_can") || !current_user_can("manage_options"))
4
  {
5
  die(__("You do not have permissions to perform this action.", "pmpro"));
6
  }
adminpages/addons/images/pmpro-aweber.gif DELETED
Binary file
adminpages/addons/images/pmpro-bbpress.jpg DELETED
Binary file
adminpages/addons/images/pmpro-constant-contact.gif DELETED
Binary file
adminpages/addons/images/pmpro-email-templates.gif DELETED
Binary file
adminpages/addons/images/pmpro-woocommerce.gif DELETED
Binary file
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
  )
@@ -22,7 +22,7 @@ function pmpro_addon_pmpro_addon_packages_widget($addon)
22
  <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-addon-packages/pmpro-addon-packages.php")) { ?>
23
  <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-addon-packages/pmpro-addon-packages.php'), 'activate-plugin_pmpro-addon-packages/pmpro-addon-packages.php')?>" class="button button-primary">Activate</a>
24
  <?php } else { ?>
25
- <a href="https://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-addon-packages.zip" class="button button-primary">Download</a>
26
  <?php } ?>
27
  </div>
28
  </div> <!-- end info -->
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Addon Packages',
8
+ 'version' => '.1.3',
9
  'widget' => 'pmpro_addon_pmpro_addon_packages_widget',
10
  'enabled' => function_exists('pmproap_post_meta')
11
  )
22
  <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-addon-packages/pmpro-addon-packages.php")) { ?>
23
  <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-addon-packages/pmpro-addon-packages.php'), 'activate-plugin_pmpro-addon-packages/pmpro-addon-packages.php')?>" class="button button-primary">Activate</a>
24
  <?php } else { ?>
25
+ <a href="https://github.com/strangerstudios/pmpro-addon-packages/archive/master.zip" class="button button-primary">Download</a>
26
  <?php } ?>
27
  </div>
28
  </div> <!-- end info -->
adminpages/addons/pmpro-affiliates.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Affiliates',
8
- 'version' => '.2.4',
9
  'widget' => 'pmpro_addon_pmpro_affiliates_widget',
10
  'enabled' => function_exists('pmpro_affiliates_dependencies')
11
  )
@@ -22,7 +22,7 @@ function pmpro_addon_pmpro_affiliates_widget($addon)
22
  <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-affiliates/pmpro-affiliates.php")) { ?>
23
  <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-affiliates/pmpro-affiliates.php'), 'activate-plugin_pmpro-affiliates/pmpro-affiliates.php')?>" class="button button-primary">Activate</a>
24
  <?php } else { ?>
25
- <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-affiliates.zip" class="button button-primary">Download</a>
26
  <?php } ?>
27
  </div>
28
  </div> <!-- end info -->
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Affiliates',
8
+ 'version' => '.2.2',
9
  'widget' => 'pmpro_addon_pmpro_affiliates_widget',
10
  'enabled' => function_exists('pmpro_affiliates_dependencies')
11
  )
22
  <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-affiliates/pmpro-affiliates.php")) { ?>
23
  <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-affiliates/pmpro-affiliates.php'), 'activate-plugin_pmpro-affiliates/pmpro-affiliates.php')?>" class="button button-primary">Activate</a>
24
  <?php } else { ?>
25
+ <a href="https://github.com/strangerstudios/pmpro-affiliates/archive/master.zip" class="button button-primary">Download</a>
26
  <?php } ?>
27
  </div>
28
  </div> <!-- end info -->
adminpages/addons/pmpro-aweber.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /*
3
- Addon: PMPro AWeber Integration
4
- Slug: pmpro-aweber
5
- */
6
- pmpro_add_addon('thirdparty', array(
7
- 'title' => 'PMPro AWeber Integration',
8
- 'version' => '1.0',
9
- 'widget' => 'pmpro_addon_pmpro_aweber_widget',
10
- 'enabled' => function_exists('pmproaw_init')
11
- )
12
- );
13
-
14
- function pmpro_addon_pmpro_aweber_widget($addon)
15
- {
16
- ?>
17
- <img class="addon-thumb" src="<?php echo PMPRO_URL?>/adminpages/addons/images/pmpro-aweber.gif" />
18
- <div class="info">
19
- <p>Integrate User Registrations with AWeber. Adds members to lists based on their membership level. (Note: works without PMPro as well.)</p>
20
- <div class="actions">
21
- <?php if($addon['enabled']) { ?>
22
- <a href="<?php echo admin_url("plugins.php");?>" class="button">Enabled</a>
23
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-aweber/pmpro-aweber.php")) { ?>
24
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-aweber/pmpro-aweber.php'), 'activate-plugin_pmpro-aweber/pmpro-aweber.php')?>" class="button button-primary">Activate</a>
25
- <?php } else { ?>
26
- <a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=pmpro-aweber'), 'install-plugin_pmpro-aweber'); ?>" class="button button-primary">Download</a>
27
- <?php } ?>
28
- </div>
29
- </div> <!-- end info -->
30
- <?php
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adminpages/addons/pmpro-bbpress.php CHANGED
@@ -3,28 +3,25 @@
3
  Addon: PMPro bbPress
4
  Slug: pmpro-bbpress
5
  */
6
- 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
 
14
  function pmpro_addon_pmpro_bbpress_widget($addon)
15
  {
16
  ?>
17
- <img class="addon-thumb" src="<?php echo PMPRO_URL?>/adminpages/addons/images/pmpro-bbpress.jpg" />
18
  <div class="info">
19
  <p>Locking down bbPress Forums by Membership Level and Forum ID.</p>
20
  <div class="actions">
21
  <?php if($addon['enabled']) { ?>
22
- <a href="<?php echo admin_url("plugins.php");?>" class="button">Enabled</a>
23
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-bbpress/pmpro-bbpress.php")) { ?>
24
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-bbpress/pmpro-bbpress.php'), 'activate-plugin_pmpro-bbpress/pmpro-bbpress.php')?>" class="button button-primary">Activate</a>
25
  <?php } else { ?>
26
- <a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=pmpro-bbpress'), 'install-plugin_pmpro-bbpress'); ?>" class="button button-primary">Download</a>
27
- <?php } ?>
28
  </div>
29
  </div> <!-- end info -->
30
  <?php
3
  Addon: PMPro bbPress
4
  Slug: pmpro-bbpress
5
  */
6
+ pmpro_add_addon('gists', array(
7
  'title' => 'PMPro bbPress',
8
+ 'version' => '.1',
9
  'widget' => 'pmpro_addon_pmpro_bbpress_widget',
10
+ 'enabled' => function_exists('pmpro_check_forum')
11
  )
12
  );
13
 
14
  function pmpro_addon_pmpro_bbpress_widget($addon)
15
  {
16
  ?>
 
17
  <div class="info">
18
  <p>Locking down bbPress Forums by Membership Level and Forum ID.</p>
19
  <div class="actions">
20
  <?php if($addon['enabled']) { ?>
21
+ <a target="_blank" href="https://gist.github.com/strangerstudios/1633637" class="button">Enabled</a>
 
 
22
  <?php } else { ?>
23
+ <a target="_blank" href="https://gist.github.com/strangerstudios/1633637" class="button button-primary">View Gist</a>
24
+ <?php } ?>
25
  </div>
26
  </div> <!-- end info -->
27
  <?php
adminpages/addons/pmpro-constant-contact.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /*
3
- Addon: PMPro Constant Contact Integration
4
- Slug: pmpro-constant-contact
5
- */
6
- pmpro_add_addon('thirdparty', array(
7
- 'title' => 'PMPro Constant Contact Integration',
8
- 'version' => '1.0',
9
- 'widget' => 'pmpro_addon_pmpro_constant_contact_widget',
10
- 'enabled' => function_exists('pmprocc_init')
11
- )
12
- );
13
-
14
- function pmpro_addon_pmpro_constant_contact_widget($addon)
15
- {
16
- ?>
17
- <img class="addon-thumb" src="<?php echo PMPRO_URL?>/adminpages/addons/images/pmpro-constant-contact.gif" />
18
- <div class="info">
19
- <p>Integrate User Registrations with Constant Contact . Adds members to lists based on their membership level. (Note: works without PMPro as well.)</p>
20
- <div class="actions">
21
- <?php if($addon['enabled']) { ?>
22
- <a href="<?php echo admin_url("plugins.php");?>" class="button">Enabled</a>
23
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-constant-contact/pmpro-constant-contact.php")) { ?>
24
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-constant-contact/pmpro-constant-contact.php'), 'activate-plugin_pmpro-constant-contact/pmpro-constant-contact.php')?>" class="button button-primary">Activate</a>
25
- <?php } else { ?>
26
- <a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=pmpro-constant-contact'), 'install-plugin_pmpro-constant-contact'); ?>" class="button button-primary">Download</a>
27
- <?php } ?>
28
- </div>
29
- </div> <!-- end info -->
30
- <?php
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adminpages/addons/pmpro-email-templates.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /*
3
- Addon: PMPro Email Templates Editor
4
- Slug: pmpro-email-templates-addon
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
- )
12
- );
13
-
14
- function pmpro_addon_email_templates_widget($addon)
15
- {
16
- ?>
17
- <img class="addon-thumb" src="<?php echo PMPRO_URL?>/adminpages/addons/images/pmpro-email-templates.gif" />
18
- <div class="info">
19
- <p>Easily edit system-generated Email Templates from the WordPress admin.</p>
20
- <div class="actions">
21
- <?php if($addon['enabled']) { ?>
22
- <a href="http://wordpress.org/plugins/pmpro-email-templates-addon/" class="button">Enabled</a>
23
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-email-templates-addon/pmpro-email-templates.php")) { ?>
24
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-email-templates-addon/pmpro-email-templates.php'), 'activate-plugin_pmpro-email-templates-addon/pmpro-email-templates.php')?>" class="button button-primary">Activate</a>
25
- <?php } else { ?>
26
- <a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=pmpro-email-templates-addon'), 'install-plugin_pmpro-email-templates-addon'); ?>" class="button button-primary">Download</a>
27
- <?php } ?>
28
- </div>
29
- </div> <!-- end info -->
30
- <?php
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adminpages/addons/pmpro-expiration.php CHANGED
@@ -3,11 +3,11 @@
3
  Addon: PMPro Expiration Date
4
  Slug: pmpro-expiration
5
  */
6
- pmpro_add_addon('github', array(
7
- 'title' => 'PMPro Set Expiration Dates',
8
- 'version' => '.1.1',
9
  'widget' => 'pmpro_addon_pmpro_expiration_widget',
10
- 'enabled' => function_exists('pmprosed_pmpro_checkout_level')
11
  )
12
  );
13
 
@@ -15,15 +15,13 @@ function pmpro_addon_pmpro_expiration_widget($addon)
15
  {
16
  ?>
17
  <div class="info">
18
- <p>Set a specific expiration date (e.g. 2013-12-31) for a PMPro membership level or discount code.</p>
19
  <div class="actions">
20
  <?php if($addon['enabled']) { ?>
21
- <a href="https://github.com/strangerstudios/pmpro-set-expiration-dates/blob/master/readme.txt" class="button">Enabled</a>
22
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-set-expiration-dates/pmpro-set-expiration-dates.php")) { ?>
23
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-set-expiration-dates/pmpro-set-expiration-dates.php'), 'activate-plugin_pmpro-set-expiration-dates/pmpro-set-expiration-dates.php')?>" class="button button-primary">Activate</a>
24
  <?php } else { ?>
25
- <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-set-expiration-dates.zip" class="button button-primary">Download</a>
26
- <?php } ?>
27
  </div>
28
  </div> <!-- end info -->
29
  <?php
3
  Addon: PMPro Expiration Date
4
  Slug: pmpro-expiration
5
  */
6
+ pmpro_add_addon('gists', array(
7
+ 'title' => 'PMPro Expiration Date',
8
+ 'version' => '.1',
9
  'widget' => 'pmpro_addon_pmpro_expiration_widget',
10
+ 'enabled' => function_exists('my_pmpro_checkout_level_specific_expiration')
11
  )
12
  );
13
 
15
  {
16
  ?>
17
  <div class="info">
18
+ <p>Set a specific expiration date for a Membership Level.</p>
19
  <div class="actions">
20
  <?php if($addon['enabled']) { ?>
21
+ <a target="_blank" href="https://gist.github.com/strangerstudios/5709300" class="button">Enabled</a>
 
 
22
  <?php } else { ?>
23
+ <a target="_blank" href="https://gist.github.com/strangerstudios/5709300" class="button button-primary">View Gist</a>
24
+ <?php } ?>
25
  </div>
26
  </div> <!-- end info -->
27
  <?php
adminpages/addons/pmpro-freeaddress.php CHANGED
@@ -3,9 +3,9 @@
3
  Addon: PMPro Require Name and Address for Free Level
4
  Slug: pmpro-freerequire
5
  */
6
- pmpro_add_addon('github', array(
7
  'title' => 'PMPro Require Name/Address for Free Level',
8
- 'version' => '.2',
9
  'widget' => 'pmpro_addon_pmpro_freerequire_widget',
10
  'enabled' => function_exists('my_pmpro_checkout_boxes_require_address')
11
  )
@@ -18,12 +18,10 @@ function pmpro_addon_pmpro_freerequire_widget($addon)
18
  <p>Require name/address for free Membership Level checkout.</p>
19
  <div class="actions">
20
  <?php if($addon['enabled']) { ?>
21
- <a href="https://github.com/strangerstudios/pmpro-address-for-free-levels" class="button">Enabled</a>
22
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-address-for-free-levels/pmpro-address-for-free-levels.php")) { ?>
23
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-address-for-free-levels/pmpro-address-for-free-levels.php'), 'activate-plugin_pmpro-address-for-free-levels/pmpro-address-for-free-levels.php')?>" class="button button-primary">Activate</a>
24
  <?php } else { ?>
25
- <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-address-for-free-levels.zip" class="button button-primary">Download</a>
26
- <?php } ?>
27
  </div>
28
  </div> <!-- end info -->
29
  <?php
3
  Addon: PMPro Require Name and Address for Free Level
4
  Slug: pmpro-freerequire
5
  */
6
+ pmpro_add_addon('gists', array(
7
  'title' => 'PMPro Require Name/Address for Free Level',
8
+ 'version' => '.1',
9
  'widget' => 'pmpro_addon_pmpro_freerequire_widget',
10
  'enabled' => function_exists('my_pmpro_checkout_boxes_require_address')
11
  )
18
  <p>Require name/address for free Membership Level checkout.</p>
19
  <div class="actions">
20
  <?php if($addon['enabled']) { ?>
21
+ <a target="_blank" href="https://gist.github.com/strangerstudios/5716249" class="button">Enabled</a>
 
 
22
  <?php } else { ?>
23
+ <a target="_blank" href="https://gist.github.com/strangerstudios/5716249" class="button button-primary">View Gist</a>
24
+ <?php } ?>
25
  </div>
26
  </div> <!-- end info -->
27
  <?php
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
  )
@@ -19,12 +19,12 @@ function pmpro_addon_pmpro_infusionsoft_widget($addon)
19
  <p>Integrate with Infusionsoft. Add members to email lists (groups, tags) based on their membership level. (Note: works without PMPro as well.)</p>
20
  <div class="actions">
21
  <?php if($addon['enabled']) { ?>
22
- <a href="<?php echo admin_url("plugins.php");?>" class="button">Enabled</a>
23
  <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-infusionsoft/pmpro-infusionsoft.php")) { ?>
24
  <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-infusionsoft/pmpro-infusionsoft.php'), 'activate-plugin_pmpro-infusionsoft/pmpro-infusionsoft.php')?>" class="button button-primary">Activate</a>
25
  <?php } else { ?>
26
- <a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=pmpro-infusionsoft'), 'install-plugin_pmpro-infusionsoft'); ?>" class="button button-primary">Download</a>
27
- <?php } ?>
28
  </div>
29
  </div> <!-- end info -->
30
  <?php
5
  */
6
  pmpro_add_addon('thirdparty', array(
7
  'title' => 'PMPro Infusionsoft Integration',
8
+ 'version' => '.1',
9
  'widget' => 'pmpro_addon_pmpro_infusionsoft_widget',
10
  'enabled' => function_exists('pmprois_init')
11
  )
19
  <p>Integrate with Infusionsoft. Add members to email lists (groups, tags) based on their membership level. (Note: works without PMPro as well.)</p>
20
  <div class="actions">
21
  <?php if($addon['enabled']) { ?>
22
+ <a href="https://github.com/strangerstudios/pmpro-infusionsoft/" class="button">Enabled</a>
23
  <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-infusionsoft/pmpro-infusionsoft.php")) { ?>
24
  <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-infusionsoft/pmpro-infusionsoft.php'), 'activate-plugin_pmpro-infusionsoft/pmpro-infusionsoft.php')?>" class="button button-primary">Activate</a>
25
  <?php } else { ?>
26
+ <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-infusionsoft.zip" class="button button-primary">Download</a>
27
+ <?php } ?>
28
  </div>
29
  </div> <!-- end info -->
30
  <?php
adminpages/addons/pmpro-international-addresses.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /*
3
- Addon: PMPro International Addresses
4
- Slug: pmpro-international-addresses
5
- */
6
- pmpro_add_addon('github', array(
7
- 'title' => 'PMPro International Addresses',
8
- 'version' => '.2.2',
9
- 'widget' => 'pmpro_addon_pmpro_international_addresses_widget',
10
- 'enabled' => function_exists('pmproia_pmpro_international_addresses')
11
- )
12
- );
13
-
14
- function pmpro_addon_pmpro_international_addresses_widget($addon)
15
- {
16
- ?>
17
- <?php /* <img class="addon-thumb" src="<?php echo PMPRO_URL?>/adminpages/addons/images/pmpro-international-addresses.jpg" /> */ ?>
18
- <div class="info">
19
- <p>Adds long form addresses to the PMPro checkout.</p>
20
- <div class="actions">
21
- <?php if($addon['enabled']) { ?>
22
- <a href="https://github.com/strangerstudios/pmpro-international-addresses/" class="button">Enabled</a>
23
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-international-addresses/pmpro-international-addresses.php")) { ?>
24
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-international-addresses/pmpro-international-addresses.php'), 'activate-plugin_pmpro-international-addresses/pmpro-international-addresses.php')?>" class="button button-primary">Activate</a>
25
- <?php } else { ?>
26
- <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-international-addresses.zip" class="button button-primary">Download</a>
27
- <?php } ?>
28
- </div>
29
- </div> <!-- end info -->
30
- <?php
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  )
@@ -19,12 +19,12 @@ function pmpro_addon_pmpro_mailchimp_widget($addon)
19
  <p>Integrate User Registrations with Mailchimp. Adds members to lists based on their membership level. (Note: works without PMPro as well.)</p>
20
  <div class="actions">
21
  <?php if($addon['enabled']) { ?>
22
- <a href="<?php echo admin_url("plugins.php");?>" class="button">Enabled</a>
23
  <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-mailchimp/pmpro-mailchimp.php")) { ?>
24
  <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-mailchimp/pmpro-mailchimp.php'), 'activate-plugin_pmpro-mailchimp/pmpro-mailchimp.php')?>" class="button button-primary">Activate</a>
25
  <?php } else { ?>
26
- <a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=pmpro-mailchimp'), 'install-plugin_pmpro-mailchimp'); ?>" class="button button-primary">Download</a>
27
- <?php } ?>
28
  </div>
29
  </div> <!-- end info -->
30
  <?php
5
  */
6
  pmpro_add_addon('thirdparty', array(
7
  'title' => 'PMPro MailChimp Integration',
8
+ 'version' => '.2.1',
9
  'widget' => 'pmpro_addon_pmpro_mailchimp_widget',
10
  'enabled' => function_exists('pmpromc_init')
11
  )
19
  <p>Integrate User Registrations with Mailchimp. Adds members to lists based on their membership level. (Note: works without PMPro as well.)</p>
20
  <div class="actions">
21
  <?php if($addon['enabled']) { ?>
22
+ <a href="https://github.com/strangerstudios/pmpro-mailchimp/" class="button">Enabled</a>
23
  <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-mailchimp/pmpro-mailchimp.php")) { ?>
24
  <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-mailchimp/pmpro-mailchimp.php'), 'activate-plugin_pmpro-mailchimp/pmpro-mailchimp.php')?>" class="button button-primary">Activate</a>
25
  <?php } else { ?>
26
+ <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-mailchimp.zip" class="button button-primary">Download</a>
27
+ <?php } ?>
28
  </div>
29
  </div> <!-- end info -->
30
  <?php
adminpages/addons/pmpro-network-subsite.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /*
3
- Addon: PMPro Network
4
- Slug: pmpro-network-subsite
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
- )
12
- );
13
-
14
- function pmpro_addon_pmpro_network_subsite_widget($addon)
15
- {
16
- ?>
17
- <img class="addon-thumb" src="<?php echo PMPRO_URL?>/adminpages/addons/images/pmpro-network.gif" />
18
- <div class="info">
19
- <p>Have network subsites use membership data from a "main" site to handle access restrictions.</p>
20
- <div class="actions">
21
- <?php if($addon['enabled']) { ?>
22
- <a href="https://github.com/strangerstudios/pmpro-network-subsite" class="button">Enabled</a>
23
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-network-subsite/pmpro-network-subsite.php")) { ?>
24
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-network-subsite/pmpro-network-subsite.php'), 'activate-plugin_pmpro-network-subsite/pmpro-network-subsite.php')?>" class="button button-primary">Activate</a>
25
- <?php } else { ?>
26
- <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-network-subsite.zip" class="button button-primary">Download</a>
27
- <?php } ?>
28
- </div>
29
- </div> <!-- end info -->
30
- <?php
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adminpages/addons/pmpro-network.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Network',
8
- 'version' => '.3.1',
9
  'widget' => 'pmpro_addon_pmpro_network_widget',
10
  'enabled' => function_exists('pmpron_new_blogs_settings')
11
  )
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro Network',
8
+ 'version' => '.2',
9
  'widget' => 'pmpro_addon_pmpro_network_widget',
10
  'enabled' => function_exists('pmpron_new_blogs_settings')
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' => '.3',
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',
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',
9
  'widget' => 'pmpro_addon_pmpro_series_widget',
10
  'enabled' => class_exists("PMProSeries")
11
  )
adminpages/addons/pmpro-shipping.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /*
3
- Addon: PMPro Shipping Add On
4
- Slug: pmpro-shipping
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
- )
12
- );
13
-
14
- function pmpro_addon_pmpro_shipping_widget($addon)
15
- {
16
- ?>
17
- <?php /* <img class="addon-thumb" src="<?php echo PMPRO_URL?>/adminpages/addons/images/pmpro-shipping.jpg" /> */ ?>
18
- <div class="info">
19
- <p>Adds shipping fields to the checkout page, confirmation page, confirmation emails, member's list and edit user profile pages.</p>
20
- <div class="actions">
21
- <?php if($addon['enabled']) { ?>
22
- <a href="https://github.com/strangerstudios/pmpro-shipping/" class="button">Enabled</a>
23
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-shipping/pmpro-shipping.php")) { ?>
24
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-shipping/pmpro-shipping.php'), 'activate-plugin_pmpro-shipping/pmpro-shipping.php')?>" class="button button-primary">Activate</a>
25
- <?php } else { ?>
26
- <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-shipping.zip" class="button button-primary">Download</a>
27
- <?php } ?>
28
- </div>
29
- </div> <!-- end info -->
30
- <?php
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adminpages/addons/pmpro-stripe-lite.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Addon: PMPro Stripe Lite
4
+ Slug: pmpro-stripe-lite
5
+ */
6
+ pmpro_add_addon('github', array(
7
+ 'title' => 'PMPro Stripe Lite',
8
+ 'version' => '.1.1',
9
+ 'widget' => 'pmpro_addon_pmpro_stripe_lite_widget',
10
+ 'enabled' => function_exists('pmprosl_pmpro_pages_shortcode_checkout')
11
+ )
12
+ );
13
+
14
+ function pmpro_addon_pmpro_stripe_lite_widget($addon)
15
+ {
16
+ ?>
17
+ <div class="info">
18
+ <p>Remove billing fields (not required by Stripe) from the checkout page when using the Stripe payment gateway with PMPro.</p>
19
+ <div class="actions">
20
+ <?php if($addon['enabled']) { ?>
21
+ <a href="https://github.com/strangerstudios/pmpro-stripe-lite/blob/master/readme.txt" class="button">Enabled</a>
22
+ <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-stripe-lite/pmpro-stripe-lite.php")) { ?>
23
+ <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-stripe-lite/pmpro-stripe-lite.php'), 'activate-plugin_pmpro-stripe-lite/pmpro-stripe-lite.php')?>" class="button button-primary">Activate</a>
24
+ <?php } else { ?>
25
+ <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-stripe-lite.zip" class="button button-primary">Download</a>
26
+ <?php } ?>
27
+ </div>
28
+ </div> <!-- end info -->
29
+ <?php
30
+ }
adminpages/addons/pmpro-user-pages.php CHANGED
@@ -5,7 +5,7 @@
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro User Pages',
8
- 'version' => '.3',
9
  'widget' => 'pmpro_addon_pmpro_user_pages_widget',
10
  'enabled' => function_exists('pmproup_pmpro_after_checkout')
11
  )
@@ -14,7 +14,7 @@ pmpro_add_addon('github', array(
14
  function pmpro_addon_pmpro_user_pages_widget($addon)
15
  {
16
  ?>
17
- <div class="info">
18
  <p>Creates a unique page for each Member after checkout, giving the Admin access to write customized content for each specific member.</p>
19
  <div class="actions">
20
  <?php if($addon['enabled']) { ?>
5
  */
6
  pmpro_add_addon('github', array(
7
  'title' => 'PMPro User Pages',
8
+ 'version' => '.2',
9
  'widget' => 'pmpro_addon_pmpro_user_pages_widget',
10
  'enabled' => function_exists('pmproup_pmpro_after_checkout')
11
  )
14
  function pmpro_addon_pmpro_user_pages_widget($addon)
15
  {
16
  ?>
17
+ <div class="info">
18
  <p>Creates a unique page for each Member after checkout, giving the Admin access to write customized content for each specific member.</p>
19
  <div class="actions">
20
  <?php if($addon['enabled']) { ?>
adminpages/addons/pmpro-woocommerce.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /*
3
- Addon: PMPro WooCommerce
4
- Slug: pmpro-woocommerce
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
- )
12
- );
13
-
14
- function pmpro_addon_pmpro_woocommerce_widget($addon)
15
- {
16
- ?>
17
- <img class="addon-thumb" src="<?php echo PMPRO_URL?>/adminpages/addons/images/pmpro-woocommerce.gif" />
18
- <div class="info">
19
- <p>Use WooCommerce to purchase membership or set members-only product pricing.</p>
20
- <div class="actions">
21
- <?php if($addon['enabled']) { ?>
22
- <a href="<?php echo admin_url("plugins.php");?>" class="button">Enabled</a>
23
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-woocommerce/pmpro-woocommerce.php")) { ?>
24
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-woocommerce/pmpro-woocommerce.php'), 'activate-plugin_pmpro-woocommerce/pmpro-woocommerce.php')?>" class="button button-primary">Activate</a>
25
- <?php } else { ?>
26
- <a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=pmpro-woocommerce'), 'install-plugin_pmpro-woocommerce'); ?>" class="button button-primary">Download</a>
27
- <?php } ?>
28
- </div>
29
- </div> <!-- end info -->
30
- <?php
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adminpages/addons/pmpro-wp-affiliate.php CHANGED
@@ -19,12 +19,10 @@ function pmpro_addon_pmpro_wp_affiliate_widget($addon)
19
  <p>Process an affiliate via WP Affiliate Platform after a PMPro checkout.</p>
20
  <div class="actions">
21
  <?php if($addon['enabled']) { ?>
22
- <a href="https://github.com/strangerstudios/pmpro-wp-affiliate-platform/" class="button">Enabled</a>
23
- <?php } elseif(file_exists(dirname(__FILE__) . "/../../../pmpro-wp-affiliate-platform/pmpro-wp-affiliate-platform.php")) { ?>
24
- <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-wp-affiliate-platform/pmpro-wp-affiliate-platform.php'), 'activate-plugin_pmpro-wp-affiliate-platform/pmpro-wp-affiliate-platform.php')?>" class="button button-primary">Activate</a>
25
  <?php } else { ?>
26
- <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-wp-affiliate-platform.zip" class="button button-primary">Download</a>
27
- <?php } ?>
28
  </div>
29
  </div> <!-- end info -->
30
  <?php
19
  <p>Process an affiliate via WP Affiliate Platform after a PMPro checkout.</p>
20
  <div class="actions">
21
  <?php if($addon['enabled']) { ?>
22
+ <a target="_blank" href="https://gist.github.com/strangerstudios/3137539" class="button">Enabled</a>
 
 
23
  <?php } else { ?>
24
+ <a target="_blank" href="https://gist.github.com/strangerstudios/3137539" class="button button-primary">View Gist</a>
25
+ <?php } ?>
26
  </div>
27
  </div> <!-- end info -->
28
  <?php
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.8'
11
  )
12
  );
13
 
adminpages/addons/wp-bouncer.php CHANGED
@@ -3,9 +3,9 @@
3
  Addon: WP Bouncer
4
  Slug: wp-bouncer
5
  */
6
- pmpro_add_addon('repo', array(
7
  'title' => 'WP Bouncer',
8
- 'version' => '1.1',
9
  'widget' => 'pmpro_addon_wp_bouncer_widget',
10
  'enabled' => class_exists('WP_Bouncer')
11
  )
@@ -19,11 +19,11 @@ function pmpro_addon_wp_bouncer_widget($addon)
19
  <p>Make sure users are only logged in from one computer or device at a time.</p>
20
  <div class="actions">
21
  <?php if($addon['enabled']) { ?>
22
- <a href="http://wordpress.org/plugins/wp-bouncer/" class="button">Enabled</a>
23
  <?php } elseif(file_exists(dirname(__FILE__) . "/../../../wp-bouncer/wp-bouncer.php")) { ?>
24
  <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=wp-bouncer/wp-bouncer.php'), 'activate-plugin_wp-bouncer/wp-bouncer.php')?>" class="button button-primary">Activate</a>
25
  <?php } else { ?>
26
- <a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=wp-bouncer'), 'install-plugin_wp-bouncer'); ?>" class="button button-primary">Download</a>
27
  <?php } ?>
28
  </div>
29
  </div> <!-- end info -->
3
  Addon: WP Bouncer
4
  Slug: wp-bouncer
5
  */
6
+ pmpro_add_addon('github', array(
7
  'title' => 'WP Bouncer',
8
+ 'version' => '1.0.1',
9
  'widget' => 'pmpro_addon_wp_bouncer_widget',
10
  'enabled' => class_exists('WP_Bouncer')
11
  )
19
  <p>Make sure users are only logged in from one computer or device at a time.</p>
20
  <div class="actions">
21
  <?php if($addon['enabled']) { ?>
22
+ <a href="https://github.com/strangerstudios/wp-bouncer/blob/master/readme.txt" class="button">Enabled</a>
23
  <?php } elseif(file_exists(dirname(__FILE__) . "/../../../wp-bouncer/wp-bouncer.php")) { ?>
24
  <a href="<?php echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=wp-bouncer/wp-bouncer.php'), 'activate-plugin_wp-bouncer/wp-bouncer.php')?>" class="button button-primary">Activate</a>
25
  <?php } else { ?>
26
+ <a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/wp-bouncer.zip" class="button button-primary">Download</a>
27
  <?php } ?>
28
  </div>
29
  </div> <!-- end info -->
adminpages/admin_header.php CHANGED
@@ -92,27 +92,6 @@
92
  $msgt .= " <a href=\"?page=pmpro-membershiplevels\">" . __("Please edit your levels", "pmpro") . "</a>.";
93
  }
94
 
95
- if(!pmpro_checkLevelForTwoCheckoutCompatibility())
96
- {
97
- $msg = -1;
98
- $msgt = __("The billing details for some of your membership levels is not supported by TwoCheckout.", "pmpro");
99
- if($view == "pmpro-membershiplevels" && !empty($_REQUEST['edit']) && $_REQUEST['edit'] > 0)
100
- {
101
- if(!pmpro_checkLevelForTwoCheckoutCompatibility($_REQUEST['edit']))
102
- {
103
- global $pmpro_twocheckout_error;
104
- $pmpro_twocheckout_error = true;
105
-
106
- $msg = -1;
107
- $msgt = __("The billing details for this level are not supported by 2Checkout. Please review the notes in the Billing Details section below.", "pmpro");
108
- }
109
- }
110
- elseif($view == "pmpro-membershiplevels")
111
- $msgt .= " " . __("The levels with issues are highlighted below.", "pmpro");
112
- else
113
- $msgt .= " <a href=\"?page=pmpro-membershiplevels\">" . __("Please edit your levels", "pmpro") . "</a>.";
114
- }
115
-
116
  if(!empty($msg))
117
  {
118
  ?>
@@ -124,7 +103,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>
92
  $msgt .= " <a href=\"?page=pmpro-membershiplevels\">" . __("Please edit your levels", "pmpro") . "</a>.";
93
  }
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  if(!empty($msg))
96
  {
97
  ?>
103
  <div class="wrap pmpro_admin">
104
  <div class="pmpro_banner">
105
  <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>
106
+ <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>
107
 
108
  <br style="clear:both;" />
109
  </div>
adminpages/advancedsettings.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  //only admins can get this
3
- if(!function_exists("current_user_can") || (!current_user_can("manage_options") && !current_user_can("pmpro_advancedsettings")))
4
  {
5
  die(__("You do not have permissions to perform this action.", "pmpro"));
6
  }
@@ -14,7 +14,6 @@
14
  pmpro_setOption("nonmembertext");
15
  pmpro_setOption("notloggedintext");
16
  pmpro_setOption("rsstext");
17
- pmpro_setOption("filterqueries");
18
  pmpro_setOption("showexcerpts");
19
  pmpro_setOption("hideads");
20
  pmpro_setOption("hideadslevels");
@@ -30,13 +29,6 @@
30
 
31
  //footer link
32
  pmpro_setOption("hide_footer_link");
33
-
34
- // custom settings (added with pmpro_custom_advanced_settings hook)
35
- foreach($_REQUEST as $key => $value ) {
36
- if (strpos($key, 'custom_') === 0) {
37
- pmpro_setOption($key);
38
- }
39
- }
40
 
41
  //assume success
42
  $msg = true;
@@ -47,7 +39,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
 
@@ -65,17 +56,17 @@
65
  //default settings
66
  if(!$nonmembertext)
67
  {
68
- $nonmembertext = sprintf( __( 'This content is for !!levels!! members only. <a href="%s">Register here</a>.', 'pmpro' ), wp_login_url() . "?action=register" );
69
  pmpro_setOption("nonmembertext", $nonmembertext);
70
  }
71
  if(!$notloggedintext)
72
  {
73
- $notloggedintext = sprintf( __( 'Please <a href="%s">login</a> to view this content. (<a href="%s">Register here</a>.)', 'pmpro' ), wp_login_url( get_permalink() ), wp_login_url() . "?action=register" );
74
  pmpro_setOption("notloggedintext", $notloggedintext);
75
  }
76
  if(!$rsstext)
77
  {
78
- $rsstext = __( 'This content is for members only. Visit the site and log in/register to read.', 'pmpro' );
79
  pmpro_setOption("rsstext", $rsstext);
80
  }
81
 
@@ -119,27 +110,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>
@@ -257,73 +237,9 @@ if(pmpro_displayAds())
257
  <option value="1" <?php if($hide_footer_link == 1) { ?>selected="selected"<?php } ?>>Yes - Hide the link.</option>
258
  </select>
259
  </td>
260
- </tr>
261
- */
262
-
263
- // Filter to Add More Advanced Settings for Misc Plugin Options, etc.
264
- if (has_action('pmpro_custom_advanced_settings')) {
265
- $custom_fields = apply_filters('pmpro_custom_advanced_settings', $custom_fields);
266
- foreach ($custom_fields as $field) {
267
- ?>
268
- <tr>
269
- <th valign="top" scope="row">
270
- <label
271
- for="<?php _e($field['field_name'], 'pmpro'); ?>"><?php _e($field['label'], 'pmpro'); ?></label>
272
- </th>
273
- <td>
274
- <?php
275
- switch ($field['field_type']) {
276
- case 'select':
277
- ?>
278
- <select id="<?php _e($field['field_name'], 'pmpro'); ?>"
279
- name="<?php _e($field['field_name'], 'pmpro'); ?>">
280
- <?php foreach ($field['options'] as $option) {
281
- ?>
282
- <option value="<?php _e($option, 'pmpro'); ?>"
283
- <?php
284
- if ($option == pmpro_getOption($field['field_name'])) {
285
- _e('selected', 'pmpro');
286
- }
287
- ?>
288
- ><?php _e($option, 'pmpro'); ?></option>
289
- <?php
290
- } ?>
291
- </select>
292
- <?php
293
- break;
294
- case 'text':
295
- ?>
296
- <input id="<?php _e($field['field_name'], 'pmpro'); ?>"
297
- name="<?php _e($field['field_name'], 'pmpro'); ?>"
298
- type="<?php _e($field['field_type'], 'pmpro'); ?>"
299
- value="<?php echo pmpro_getOption($field['field_name']); ?> ">
300
- <?php
301
- break;
302
- case 'textarea':
303
- ?>
304
- <textarea id="<?php _e($field['field_name'], 'pmpro'); ?>"
305
- name="<?php _e($field['field_name'], 'pmpro'); ?>">
306
- <?php echo pmpro_getOption($field['field_name']); ?>
307
- </textarea>
308
- <?php
309
- break;
310
- default:
311
- break;
312
- }
313
- if (!empty($field['description'])) {
314
- ?>
315
- <br>
316
- <small><?php _e($field['description'], 'pmpro'); ?></small>
317
- <?php
318
- }
319
- ?>
320
- </td>
321
- <?php
322
- }
323
- }
324
- ?>
325
- </tr>
326
- </tbody>
327
  </table>
328
  <script>
329
  function pmpro_updateHideAdsTRs()
@@ -365,7 +281,7 @@ if(pmpro_displayAds())
365
  </script>
366
 
367
  <p class="submit">
368
- <input name="savesettings" type="submit" class="button button-primary" value="<?php _e('Save Settings', 'pmpro');?>" />
369
  </p>
370
  </form>
371
 
1
  <?php
2
  //only admins can get this
3
+ if(!function_exists("current_user_can") || !current_user_can("manage_options"))
4
  {
5
  die(__("You do not have permissions to perform this action.", "pmpro"));
6
  }
14
  pmpro_setOption("nonmembertext");
15
  pmpro_setOption("notloggedintext");
16
  pmpro_setOption("rsstext");
 
17
  pmpro_setOption("showexcerpts");
18
  pmpro_setOption("hideads");
19
  pmpro_setOption("hideadslevels");
29
 
30
  //footer link
31
  pmpro_setOption("hide_footer_link");
 
 
 
 
 
 
 
32
 
33
  //assume success
34
  $msg = true;
39
  $notloggedintext = pmpro_getOption("notloggedintext");
40
  $rsstext = pmpro_getOption("rsstext");
41
  $hideads = pmpro_getOption("hideads");
 
42
  $showexcerpts = pmpro_getOption("showexcerpts");
43
  $hideadslevels = pmpro_getOption("hideadslevels");
44
 
56
  //default settings
57
  if(!$nonmembertext)
58
  {
59
+ $nonmembertext = "This content is for !!levels!! members only. <a href=\"" . wp_login_url() . "?action=register\">Register here</a>.";
60
  pmpro_setOption("nonmembertext", $nonmembertext);
61
  }
62
  if(!$notloggedintext)
63
  {
64
+ $notloggedintext = "Please <a href=\"" . wp_login_url( get_permalink() ) . "\">login</a> to view this content. (<a href=\"" . wp_login_url() . "?action=register\">Register here</a>.)";
65
  pmpro_setOption("notloggedintext", $notloggedintext);
66
  }
67
  if(!$rsstext)
68
  {
69
+ $rsstext = "This content is for members only. Visit the site and log in/register to read.";
70
  pmpro_setOption("rsstext", $rsstext);
71
  }
72
 
110
 
111
  <tr>
112
  <th scope="row" valign="top">
113
+ <label for="showexcerpts"><?php _e('Show Excerpts to Non-Members?', 'pmpro');?></label>
114
  </th>
115
  <td>
116
+ <select id="showexcerpts" name="showexcerpts">
117
+ <option value="0" <?php if(!$showexcerpts) { ?>selected="selected"<?php } ?>><?php _e('No - Hide excerpts.', 'pmpro');?></option>
118
+ <option value="1" <?php if($showexcerpts == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes - Show excerpts.', 'pmpro');?></option>
119
  </select>
120
  </td>
121
  </tr>
122
  <tr>
 
 
 
 
 
 
 
 
 
 
 
123
  <th scope="row" valign="top">
124
  <label for="hideads">Hide Ads From Members?</label>
125
  </th>
237
  <option value="1" <?php if($hide_footer_link == 1) { ?>selected="selected"<?php } ?>>Yes - Hide the link.</option>
238
  </select>
239
  </td>
240
+ </tr>
241
+ */ ?>
242
+ </tbody>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  </table>
244
  <script>
245
  function pmpro_updateHideAdsTRs()
281
  </script>
282
 
283
  <p class="submit">
284
+ <input name="savesettings" type="submit" class="button-primary" value="<?php _e('Save Settings', 'pmpro');?>" />
285
  </p>
286
  </form>
287
 
adminpages/dashboard.php CHANGED
@@ -105,9 +105,9 @@
105
 
106
  echo '</ul>';
107
  echo '<br class="clear"/><div style="margin-top:10px;border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
108
- echo '<a target="_blank" href="'.$pmpro_feed.'"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> Subscribe with RSS</a>';
109
  echo ' &nbsp; &nbsp; &nbsp; ';
110
- echo '<a target="_blank" href="http://www.paidmembershipspro.com/blog/">View Online</a>';
111
  echo '<form class="alignright" method="post"><input type="hidden" name="pmpro_removedbwidget" value="true"/><input title="Remove this widget from all users dashboards" class="button" type="submit" value="X"/></form>';
112
  echo '</div>';
113
  }
105
 
106
  echo '</ul>';
107
  echo '<br class="clear"/><div style="margin-top:10px;border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
108
+ echo '<a href="'.$pmpro_feed.'"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> Subscribe with RSS</a>';
109
  echo ' &nbsp; &nbsp; &nbsp; ';
110
+ echo '<a href="http://www.paidmembershipspro.com/"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/wpmini-blue.png" alt=""/> View Online</a>';
111
  echo '<form class="alignright" method="post"><input type="hidden" name="pmpro_removedbwidget" value="true"/><input title="Remove this widget from all users dashboards" class="button" type="submit" value="X"/></form>';
112
  echo '</div>';
113
  }
adminpages/discountcodes.php CHANGED
@@ -1,636 +1,631 @@
1
- <?php
2
- //only admins can get this
3
- if(!function_exists("current_user_can") || (!current_user_can("manage_options") && !current_user_can("pmpro_discountcodes")))
4
- {
5
- die(__("You do not have permissions to perform this action.", "pmpro"));
6
- }
7
-
8
- //vars
9
- global $wpdb, $pmpro_currency_symbol;
10
-
11
- if(isset($_REQUEST['edit']))
12
- $edit = $_REQUEST['edit'];
13
- else
14
- $edit = false;
15
-
16
- if(isset($_REQUEST['delete']))
17
- $delete = $_REQUEST['delete'];
18
- else
19
- $delete = false;
20
-
21
- if(isset($_REQUEST['saveid']))
22
- $saveid = $_POST['saveid'];
23
- else
24
- $saveid = false;
25
-
26
- if($saveid)
27
- {
28
- //get vars
29
- $code = $_POST['code'];
30
- $starts_month = $_POST['starts_month'];
31
- $starts_day = $_POST['starts_day'];
32
- $starts_year = $_POST['starts_year'];
33
- $expires_month = $_POST['expires_month'];
34
- $expires_day = $_POST['expires_day'];
35
- $expires_year = $_POST['expires_year'];
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)
44
- {
45
- $sqlQuery = "UPDATE $wpdb->pmpro_discount_codes SET code = '" . esc_sql($code) . "', starts = '" . $starts . "', expires = '" . $expires . "', uses = '" . intval($uses) . "' WHERE id = '" . $saveid . "' LIMIT 1";
46
- if($wpdb->query($sqlQuery) !== false)
47
- {
48
- $pmpro_msg = __("Discount code updated successfully.", "pmpro");
49
- $pmpro_msgt = "success";
50
- $saved = true;
51
- $edit = $saveid;
52
- }
53
- else
54
- {
55
- $pmpro_msg = __("Error updating discount code. That code may already be in use.", "pmpro");
56
- $pmpro_msgt = "error";
57
- }
58
- }
59
- else
60
- {
61
- $sqlQuery = "INSERT INTO $wpdb->pmpro_discount_codes (code, starts, expires, uses) VALUES('" . esc_sql($code) . "', '" . $starts . "', '" . $expires . "', '" . intval($uses) . "')";
62
- if($wpdb->query($sqlQuery) !== false)
63
- {
64
- $pmpro_msg = __("Discount code added successfully.", "pmpro");
65
- $pmpro_msgt = "success";
66
- $saved = true;
67
- $edit = $wpdb->insert_id;
68
- }
69
- else
70
- {
71
- $pmpro_msg = __("Error adding discount code. That code may already be in use.", "pmpro") . $wpdb->last_error;
72
- $pmpro_msgt = "error";
73
- }
74
- }
75
-
76
- //now add the membership level rows
77
- if($saved && $edit > 0)
78
- {
79
- //get the submitted values
80
- $all_levels_a = $_REQUEST['all_levels'];
81
- if(!empty($_REQUEST['levels']))
82
- $levels_a = $_REQUEST['levels'];
83
- else
84
- $levels_a = array();
85
- $initial_payment_a = $_REQUEST['initial_payment'];
86
- if(!empty($_REQUEST['recurring']))
87
- $recurring_a = $_REQUEST['recurring'];
88
- $billing_amount_a = $_REQUEST['billing_amount'];
89
- $cycle_number_a = $_REQUEST['cycle_number'];
90
- $cycle_period_a = $_REQUEST['cycle_period'];
91
- $billing_limit_a = $_REQUEST['billing_limit'];
92
- if(!empty($_REQUEST['custom_trial']))
93
- $custom_trial_a = $_REQUEST['custom_trial'];
94
- $trial_amount_a = $_REQUEST['trial_amount'];
95
- $trial_limit_a = $_REQUEST['trial_limit'];
96
- if(!empty($_REQUEST['expiration']))
97
- $expiration_a = $_REQUEST['expiration'];
98
- $expiration_number_a = $_REQUEST['expiration_number'];
99
- $expiration_period_a = $_REQUEST['expiration_period'];
100
-
101
- //clear the old rows
102
- $sqlQuery = "DELETE FROM $wpdb->pmpro_discount_codes_levels WHERE code_id = '" . $edit . "'";
103
- $wpdb->query($sqlQuery);
104
-
105
- //add a row for each checked level
106
- if(!empty($levels_a))
107
- {
108
- foreach($levels_a as $level_id)
109
- {
110
- //get the values ready
111
- $n = array_search($level_id, $all_levels_a); //this is the key location of this level's values
112
- $initial_payment = $initial_payment_a[$n];
113
-
114
- //is this recurring?
115
- if(!empty($recurring_a))
116
- {
117
- if(in_array($level_id, $recurring_a))
118
- $recurring = 1;
119
- else
120
- $recurring = 0;
121
- }
122
- else
123
- $recurring = 0;
124
-
125
- if(!empty($recurring))
126
- {
127
- $billing_amount = $billing_amount_a[$n];
128
- $cycle_number = $cycle_number_a[$n];
129
- $cycle_period = $cycle_period_a[$n];
130
- $billing_limit = $billing_limit_a[$n];
131
-
132
- //custom trial
133
- if(!empty($custom_trial_a))
134
- {
135
- if(in_array($level_id, $custom_trial_a))
136
- $custom_trial = 1;
137
- else
138
- $custom_trial = 0;
139
- }
140
- else
141
- $custom_trial = 0;
142
-
143
- if(!empty($custom_trial))
144
- {
145
- $trial_amount = $trial_amount_a[$n];
146
- $trial_limit = $trial_limit_a[$n];
147
- }
148
- else
149
- {
150
- $trial_amount = '';
151
- $trial_limit = '';
152
- }
153
- }
154
- else
155
- {
156
- $billing_amount = '';
157
- $cycle_number = '';
158
- $cycle_period = 'Month';
159
- $billing_limit = '';
160
- $custom_trial = 0;
161
- $trial_amount = '';
162
- $trial_limit = '';
163
- }
164
-
165
- if(!empty($expiration_a))
166
- {
167
- if(in_array($level_id, $expiration_a))
168
- $expiration = 1;
169
- else
170
- $expiration = 0;
171
- }
172
- else
173
- $expiration = 0;
174
-
175
- if(!empty($expiration))
176
- {
177
- $expiration_number = $expiration_number_a[$n];
178
- $expiration_period = $expiration_period_a[$n];
179
- }
180
- else
181
- {
182
- $expiration_number = '';
183
- $expiration_period = 'Month';
184
- }
185
-
186
- //okay, do the insert
187
- $sqlQuery = "INSERT INTO $wpdb->pmpro_discount_codes_levels (code_id, level_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, expiration_number, expiration_period) VALUES('" . esc_sql($edit) . "', '" . esc_sql($level_id) . "', '" . (double)esc_sql($initial_payment) . "', '" . (double)esc_sql($billing_amount) . "', '" . intval(esc_sql($cycle_number)) . "', '" . esc_sql($cycle_period) . "', '" . intval(esc_sql($billing_limit)) . "', '" . (double)esc_sql($trial_amount) . "', '" . intval(esc_sql($trial_limit)) . "', '" . intval(esc_sql($expiration_number)) . "', '" . esc_sql($expiration_period) . "')";
188
-
189
- if($wpdb->query($sqlQuery) !== false)
190
- {
191
- //okay
192
- do_action("pmpro_save_discount_code_level", $edit, $level_id);
193
- }
194
- else
195
- {
196
- $level_errors[] = sprintf(__("Error saving values for the %s level.", "pmpro"), $wpdb->get_var("SELECT name FROM $wpdb->pmpro_membership_levels WHERE id = '" . $level_id . "' LIMIT 1"));
197
- }
198
- }
199
- }
200
-
201
- //errors?
202
- if(!empty($level_errors))
203
- {
204
- $pmpro_msg = __("There were errors updating the level values: ", "pmpro") . implode(" ", $level_errors);
205
- $pmpro_msgt = "error";
206
- }
207
- else
208
- {
209
- //all good. set edit = NULL so we go back to the overview page
210
- $edit = NULL;
211
-
212
- do_action("pmpro_save_discount_code", $saveid);
213
- }
214
- }
215
- }
216
-
217
- //are we deleting?
218
- if(!empty($delete))
219
- {
220
- //is this a code?
221
- $code = $wpdb->get_var("SELECT code FROM $wpdb->pmpro_discount_codes WHERE id = '" . $delete . "' LIMIT 1");
222
- if(!empty($code))
223
- {
224
- //action
225
- do_action("pmpro_delete_discount_code", $delete);
226
-
227
- //delete the code levels
228
- $r1 = $wpdb->query("DELETE FROM $wpdb->pmpro_discount_codes_levels WHERE code_id = '" . $delete . "'");
229
-
230
- if($r1 !== false)
231
- {
232
- //delete the code
233
- $r2 = $wpdb->query("DELETE FROM $wpdb->pmpro_discount_codes WHERE id = '" . $delete . "' LIMIT 1");
234
-
235
- if($r2 !== false)
236
- {
237
- $pmpro_msg = sprintf(__("Code %s deleted successfully.", "pmpro"), $code);
238
- $pmpro_msgt = "success";
239
- }
240
- else
241
- {
242
- $pmpro_msg = __("Error deleting discount code. The code was only partially deleted. Please try again.", "pmpro");
243
- $pmpro_msgt = "error";
244
- }
245
- }
246
- else
247
- {
248
- $pmpro_msg = __("Error deleting code. Please try again.", "pmpro");
249
- $pmpro_msgt = "error";
250
- }
251
- }
252
- else
253
- {
254
- $pmpro_msg = __("Code not found.", "pmpro");
255
- $pmpro_msgt = "error";
256
- }
257
- }
258
-
259
- require_once(dirname(__FILE__) . "/admin_header.php");
260
- ?>
261
-
262
- <?php if($edit) { ?>
263
-
264
- <h2>
265
- <?php
266
- if($edit > 0)
267
- echo __("Edit Discount Code", "pmpro");
268
- else
269
- echo __("Add New Discount Code", "pmpro");
270
- ?>
271
- </h2>
272
-
273
- <?php if(!empty($pmpro_msg)) { ?>
274
- <div id="message" class="<?php if($pmpro_msgt == "success") echo "updated fade"; else echo "error"; ?>"><p><?php echo $pmpro_msg?></p></div>
275
- <?php } ?>
276
-
277
- <div>
278
- <?php
279
- // get the code...
280
- if($edit > 0)
281
- {
282
- $code = $wpdb->get_row("SELECT *, UNIX_TIMESTAMP(starts) as starts, UNIX_TIMESTAMP(expires) as expires FROM $wpdb->pmpro_discount_codes WHERE id = '" . $edit . "' LIMIT 1", OBJECT);
283
- $uses = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->pmpro_discount_codes_uses WHERE code_id = '" . $code->id . "'");
284
- $levels = $wpdb->get_results("SELECT l.id, l.name, cl.initial_payment, cl.billing_amount, cl.cycle_number, cl.cycle_period, cl.billing_limit, cl.trial_amount, cl.trial_limit FROM $wpdb->pmpro_membership_levels l LEFT JOIN $wpdb->pmpro_discount_codes_levels cl ON l.id = cl.level_id WHERE cl.code_id = '" . $code->code . "'");
285
- $temp_id = $code->id;
286
- }
287
- elseif(!empty($copy) && $copy > 0)
288
- {
289
- $code = $wpdb->get_row("SELECT *, UNIX_TIMESTAMP(starts) as starts, UNIX_TIMESTAMP(expires) as expires FROM $wpdb->pmpro_discount_codes WHERE id = '" . $copy . "' LIMIT 1", OBJECT);
290
- $temp_id = $level->id;
291
- $level->id = NULL;
292
- }
293
-
294
- // didn't find a discount code, let's add a new one...
295
- if(empty($code->id)) $edit = -1;
296
-
297
- //defaults for new codes
298
- if($edit == -1)
299
- {
300
- $code = new stdClass();
301
- $code->code = pmpro_getDiscountCode();
302
- }
303
- ?>
304
- <form action="" method="post">
305
- <input name="saveid" type="hidden" value="<?php echo $edit?>" />
306
- <table class="form-table">
307
- <tbody>
308
- <tr>
309
- <th scope="row" valign="top"><label><?php _e('ID', 'pmpro');?>:</label></th>
310
- <td class="pmpro_lite"><?php if(!empty($code->id)) echo $code->id; else echo __("This will be generated when you save.", "pmpro");?></td>
311
- </tr>
312
-
313
- <tr>
314
- <th scope="row" valign="top"><label for="code"><?php _e('Code', 'pmpro');?>:</label></th>
315
- <td><input name="code" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($code->code))?>" /></td>
316
- </tr>
317
-
318
- <?php
319
- //some vars for the dates
320
- $current_day = date("j");
321
- if(!empty($code->starts))
322
- $selected_starts_day = date("j", $code->starts);
323
- else
324
- $selected_starts_day = $current_day;
325
- if(!empty($code->expires))
326
- $selected_expires_day = date("j", $code->expires);
327
- else
328
- $selected_expires_day = $current_day;
329
-
330
- $current_month = date("M");
331
- if(!empty($code->starts))
332
- $selected_starts_month = date("m", $code->starts);
333
- else
334
- $selected_starts_month = date("m");
335
- if(!empty($code->expires))
336
- $selected_expires_month = date("m", $code->expires);
337
- else
338
- $selected_expires_month = date("m");
339
-
340
- $current_year = date("Y");
341
- if(!empty($code->starts))
342
- $selected_starts_year = date("Y", $code->starts);
343
- else
344
- $selected_starts_year = $current_year;
345
- if(!empty($code->expires))
346
- $selected_expires_year = date("Y", $code->expires);
347
- else
348
- $selected_expires_year = (int)$current_year + 1;
349
- ?>
350
-
351
- <tr>
352
- <th scope="row" valign="top"><label for="starts"><?php _e('Start Date', 'pmpro');?>:</label></th>
353
- <td>
354
- <select name="starts_month">
355
- <?php
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
- ?>
363
- </select>
364
- <input name="starts_day" type="text" size="2" value="<?php echo $selected_starts_day?>" />
365
- <input name="starts_year" type="text" size="4" value="<?php echo $selected_starts_year?>" />
366
- </td>
367
- </tr>
368
-
369
- <tr>
370
- <th scope="row" valign="top"><label for="expires"><?php _e('Expiration Date', 'pmpro');?>:</label></th>
371
- <td>
372
- <select name="expires_month">
373
- <?php
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
- ?>
381
- </select>
382
- <input name="expires_day" type="text" size="2" value="<?php echo $selected_expires_day?>" />
383
- <input name="expires_year" type="text" size="4" value="<?php echo $selected_expires_year?>" />
384
- </td>
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>
392
- </td>
393
- </tr>
394
-
395
- </tbody>
396
- </table>
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
404
- $levels = $wpdb->get_results("SELECT * FROM $wpdb->pmpro_membership_levels");
405
- foreach($levels as $level)
406
- {
407
- //if this level is already managed for this discount code, use the code values
408
- if($edit > 0)
409
- {
410
- $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 = '" . $edit . "' AND cl.level_id = '" . $level->id . "' LIMIT 1");
411
- if($code_level)
412
- {
413
- $level = $code_level;
414
- $level->checked = true;
415
- }
416
- else
417
- $level_checked = false;
418
- }
419
- else
420
- $level_checked = false;
421
- ?>
422
- <div>
423
- <input type="hidden" name="all_levels[]" value="<?php echo $level->id?>" />
424
- <input type="checkbox" name="levels[]" value="<?php echo $level->id?>" <?php if(!empty($level->checked)) { ?>checked="checked"<?php } ?> onclick="if(jQuery(this).is(':checked')) jQuery(this).next().show(); else jQuery(this).next().hide();" />
425
- <?php echo $level->name?>
426
- <div class="pmpro_discount_levels_pricing level_<?php echo $level->id?>" <?php if(empty($level->checked)) { ?>style="display: none;"<?php } ?>>
427
- <table class="form-table">
428
- <tbody>
429
- <tr>
430
- <th scope="row" valign="top"><label for="initial_payment"><?php _e('Initial Payment', 'pmpro');?>:</label></th>
431
- <td><?php echo $pmpro_currency_symbol?><input name="initial_payment[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->initial_payment))?>" /> <small><?php _e('The initial amount collected at registration.', 'pmpro');?></small></td>
432
- </tr>
433
-
434
- <tr>
435
- <th scope="row" valign="top"><label><?php _e('Recurring Subscription', 'pmpro');?>:</label></th>
436
- <td><input class="recurring_checkbox" name="recurring[]" type="checkbox" value="<?php echo $level->id?>" <?php if(pmpro_isLevelRecurring($level)) { echo "checked='checked'"; } ?> onclick="if(jQuery(this).attr('checked')) { jQuery(this).parent().parent().siblings('.recurring_info').show(); if(!jQuery('#custom_trial_<?php echo $level->id?>').is(':checked')) jQuery(this).parent().parent().siblings('.trial_info').hide();} else jQuery(this).parent().parent().siblings('.recurring_info').hide();" /> <small><?php _e('Check if this level has a recurring subscription payment.', 'pmpro');?></small></td>
437
- </tr>
438
-
439
- <tr class="recurring_info" <?php if(!pmpro_isLevelRecurring($level)) {?>style="display: none;"<?php } ?>>
440
- <th scope="row" valign="top"><label for="billing_amount"><?php _e('Billing Amount', 'pmpro');?>:</label></th>
441
- <td>
442
- <?php echo $pmpro_currency_symbol?><input name="billing_amount[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->billing_amount))?>" /> <small>per</small>
443
- <input name="cycle_number[]" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->cycle_number))?>" />
444
- <select name="cycle_period[]" onchange="updateCyclePeriod();">
445
- <?php
446
- $cycles = array( __('Day(s)', 'pmpro') => 'Day', __('Week(s)', 'pmpro') => 'Week', __('Month(s)', 'pmpro') => 'Month', __('Year(s)', 'pmpro') => 'Year' );
447
- foreach ( $cycles as $name => $value ) {
448
- echo "<option value='$value'";
449
- if ( $level->cycle_period == $value ) echo " selected='selected'";
450
- echo ">$name</option>";
451
- }
452
- ?>
453
- </select>
454
- <br /><small><?php _e('The amount to be billed one cycle after the initial payment.', 'pmpro');?></small>
455
- </td>
456
- </tr>
457
-
458
- <tr class="recurring_info" <?php if(!pmpro_isLevelRecurring($level)) {?>style="display: none;"<?php } ?>>
459
- <th scope="row" valign="top"><label for="billing_limit"><?php _e('Billing Cycle Limit', 'pmpro');?>:</label></th>
460
- <td>
461
- <input name="billing_limit[]" type="text" size="20" value="<?php echo $level->billing_limit?>" />
462
- <br /><small><?php _e('The <strong>total</strong> number of recurring billing cycles for this level, including the trial period (if applicable) but not including the initial payment. Set to zero if membership is indefinite.', 'pmpro');?></small>
463
- </td>
464
- </tr>
465
-
466
- <tr class="recurring_info" <?php if (!pmpro_isLevelRecurring($level)) echo "style='display:none;'";?>>
467
- <th scope="row" valign="top"><label><?php _e('Custom Trial', 'pmpro');?>:</label></th>
468
- <td><input id="custom_trial_<?php echo $level->id?>" name="custom_trial[]" type="checkbox" value="<?php echo $level->id?>" <?php if ( pmpro_isLevelTrial($level) ) { echo "checked='checked'"; } ?> onclick="if(jQuery(this).attr('checked')) jQuery(this).parent().parent().siblings('.trial_info').show(); else jQuery(this).parent().parent().siblings('.trial_info').hide();" /> <?php _e('Check to add a custom trial period.', 'pmpro');?></td>
469
- </tr>
470
-
471
- <tr class="trial_info recurring_info" <?php if (!pmpro_isLevelTrial($level)) echo "style='display:none;'";?>>
472
- <th scope="row" valign="top"><label for="trial_amount"><?php _e('Trial Billing Amount', 'pmpro');?>:</label></th>
473
- <td>
474
- <?php echo $pmpro_currency_symbol?><input name="trial_amount[]" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_amount))?>" />
475
- <small><?php _e('for the first', 'pmpro');?></small>
476
- <input name="trial_limit[]" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_limit))?>" />
477
- <small><?php _e('subscription payments', 'pmpro');?>.</small>
478
- </td>
479
- </tr>
480
-
481
- <tr>
482
- <th scope="row" valign="top"><label><?php _e('Membership Expiration', 'pmpro');?>:</label></th>
483
- <td><input id="expiration" name="expiration[]" type="checkbox" value="<?php echo $level->id?>" <?php if(pmpro_isLevelExpiring($level)) { echo "checked='checked'"; } ?> onclick="if(jQuery(this).is(':checked')) { jQuery(this).parent().parent().siblings('.expiration_info').show(); } else { jQuery(this).parent().parent().siblings('.expiration_info').hide();}" /> <?php _e('Check this to set when membership access expires.', 'pmpro');?></td>
484
- </tr>
485
-
486
- <tr class="expiration_info" <?php if(!pmpro_isLevelExpiring($level)) {?>style="display: none;"<?php } ?>>
487
- <th scope="row" valign="top"><label for="billing_amount"><?php _e('Expires In', 'pmpro');?>:</label></th>
488
- <td>
489
- <input id="expiration_number" name="expiration_number[]" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->expiration_number))?>" />
490
- <select id="expiration_period" name="expiration_period[]">
491
- <?php
492
- $cycles = array( __('Day(s)', 'pmpro') => 'Day', __('Week(s)', 'pmpro') => 'Week', __('Month(s)', 'pmpro') => 'Month', __('Year(s)', 'pmpro') => 'Year' );
493
- foreach ( $cycles as $name => $value ) {
494
- echo "<option value='$value'";
495
- if ( $level->expiration_period == $value ) echo " selected='selected'";
496
- echo ">$name</option>";
497
- }
498
- ?>
499
- </select>
500
- <br /><small><?php _e('Set the duration of membership access. Note that the any future payments (recurring subscription, if any) will be cancelled when the membership expires.', 'pmpro');?></small>
501
- </td>
502
- </tr>
503
- </tbody>
504
- </table>
505
-
506
- <?php do_action("pmpro_discount_code_after_level_settings", $edit, $level); ?>
507
-
508
- </div>
509
- </div>
510
- <script>
511
-
512
- </script>
513
- <?php
514
- }
515
- ?>
516
- </div>
517
-
518
- <p class="submit topborder">
519
- <input name="save" type="submit" class="button button-primary" value="Save Code" />
520
- <input name="cancel" type="button" class="button button-secondary" value="Cancel" onclick="location.href='<?php echo get_admin_url(NULL, '/admin.php?page=pmpro-discountcodes')?>';" />
521
- </p>
522
- </form>
523
- </div>
524
-
525
- <?php } else { ?>
526
-
527
- <h2>
528
- <?php _e('Memberships Discount Codes', 'pmpro');?>
529
- <a href="admin.php?page=pmpro-discountcodes&edit=-1" class="add-new-h2"><?php _e('Add New Discount Code', 'pmpro');?></a>
530
- </h2>
531
-
532
- <?php if(!empty($pmpro_msg)) { ?>
533
- <div id="message" class="<?php if($pmpro_msgt == "success") echo "updated fade"; else echo "error"; ?>"><p><?php echo $pmpro_msg?></p></div>
534
- <?php } ?>
535
-
536
- <form id="posts-filter" method="get" action="">
537
- <p class="search-box">
538
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search Discount Codes', 'pmpro');?>:</label>
539
- <input type="hidden" name="page" value="pmpro-discountcodes" />
540
- <input id="post-search-input" type="text" value="<?php if(!empty($s)) echo $s;?>" name="s" size="30" />
541
- <input class="button" type="submit" value="<?php _e('Search', 'pmpro');?>" id="search-submit "/>
542
- </p>
543
- </form>
544
-
545
- <br class="clear" />
546
- <?php
547
- $sqlQuery = "SELECT *, UNIX_TIMESTAMP(starts) as starts, UNIX_TIMESTAMP(expires) as expires FROM $wpdb->pmpro_discount_codes ";
548
- if(!empty($s))
549
- $sqlQuery .= "WHERE code LIKE '%$s%' ";
550
- $sqlQuery .= "ORDER BY id ASC";
551
-
552
- $codes = $wpdb->get_results($sqlQuery, OBJECT);
553
- ?>
554
- <table class="widefat">
555
- <thead>
556
- <tr>
557
- <th><?php _e('ID', 'pmpro');?></th>
558
- <th><?php _e('Code', 'pmpro');?></th>
559
- <th><?php _e('Starts', 'pmpro');?></th>
560
- <th><?php _e('Expires', 'pmpro');?></th>
561
- <th><?php _e('Uses', 'pmpro');?></th>
562
- <th><?php _e('Levels', 'pmpro');?></th>
563
- <?php do_action("pmpro_discountcodes_extra_cols_header", $codes);?>
564
- <th></th>
565
- <th></th>
566
- </tr>
567
- </thead>
568
- <tbody>
569
- <?php
570
- if(!$codes)
571
- {
572
- ?>
573
- <tr><td colspan="7" class="pmpro_pad20">
574
- <p><?php _e('Discount codes allow you to offer your memberships at discounted prices to select customers.', 'pmpro');?> <a href="admin.php?page=pmpro-discountcodes&edit=-1"><?php _e('Create your first discount code now', 'pmpro');?></a>.</p>
575
- </td></tr>
576
- <?php
577
- }
578
- else
579
- {
580
- foreach($codes as $code)
581
- {
582
- ?>
583
- <tr>
584
- <td><?php echo $code->id?></td>
585
- <td>
586
- <a href="?page=pmpro-discountcodes&edit=<?php echo $code->id?>"><?php echo $code->code?></a>
587
- </td>
588
- <td>
589
- <?php echo date(get_option('date_format'), $code->starts)?>
590
- </td>
591
- <td>
592
- <?php echo date(get_option('date_format'), $code->expires)?>
593
- </td>
594
- <td>
595
- <?php
596
- $uses = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->pmpro_discount_codes_uses WHERE code_id = '" . $code->id . "'");
597
- if($code->uses > 0)
598
- echo "<strong>" . (int)$uses . "</strong>/" . $code->uses;
599
- else
600
- echo "<strong>" . (int)$uses . "</strong>/unlimited";
601
- ?>
602
- </td>
603
- <td>
604
- <?php
605
- $sqlQuery = "SELECT l.id, l.name FROM $wpdb->pmpro_membership_levels l LEFT JOIN $wpdb->pmpro_discount_codes_levels cl ON l.id = cl.level_id WHERE cl.code_id = '" . $code->id . "'";
606
- $levels = $wpdb->get_results($sqlQuery);
607
-
608
- $level_names = array();
609
- foreach($levels as $level)
610
- $level_names[] = "<a target=\"_blank\" href=\"" . pmpro_url("checkout", "?level=" . $level->id . "&discount_code=" . $code->code) . "\">" . $level->name . "</a>";
611
- if($level_names)
612
- echo implode(", ", $level_names);
613
- else
614
- echo "None";
615
- ?>
616
- </td>
617
- <?php do_action("pmpro_discountcodes_extra_cols_body", $code);?>
618
- <td>
619
- <a href="?page=pmpro-discountcodes&edit=<?php echo $code->id?>"><?php _e('edit', 'pmpro');?></a>
620
- </td>
621
- <td>
622
- <a href="javascript:askfirst('<?php printf(__('Are you sure you want to delete the %s discount code? The subscriptions for existing users will not change, but new users will not be able to use this code anymore.', 'pmpro'), $code->code);?>', '?page=pmpro-discountcodes&delete=<?php echo $code->id?>'); void(0);"><?php _e('delete', 'pmpro');?></a>
623
- </td>
624
- </tr>
625
- <?php
626
- }
627
- }
628
- ?>
629
- </tbody>
630
- </table>
631
-
632
- <?php } ?>
633
-
634
- <?php
635
- require_once(dirname(__FILE__) . "/admin_footer.php");
636
- ?>
1
+ <?php
2
+ //only admins can get this
3
+ if(!function_exists("current_user_can") || (!current_user_can("manage_options") && !current_user_can("pmpro_discountcodes")))
4
+ {
5
+ die(__("You do not have permissions to perform this action.", "pmpro"));
6
+ }
7
+
8
+ //vars
9
+ global $wpdb, $pmpro_currency_symbol;
10
+
11
+ if(isset($_REQUEST['edit']))
12
+ $edit = $_REQUEST['edit'];
13
+ else
14
+ $edit = false;
15
+
16
+ if(isset($_REQUEST['delete']))
17
+ $delete = $_REQUEST['delete'];
18
+ else
19
+ $delete = false;
20
+
21
+ if(isset($_REQUEST['saveid']))
22
+ $saveid = $_POST['saveid'];
23
+ else
24
+ $saveid = false;
25
+
26
+ if($saveid)
27
+ {
28
+ //get vars
29
+ $code = $_POST['code'];
30
+ $starts_month = $_POST['starts_month'];
31
+ $starts_day = $_POST['starts_day'];
32
+ $starts_year = $_POST['starts_year'];
33
+ $expires_month = $_POST['expires_month'];
34
+ $expires_day = $_POST['expires_day'];
35
+ $expires_year = $_POST['expires_year'];
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)
44
+ {
45
+ $sqlQuery = "UPDATE $wpdb->pmpro_discount_codes SET code = '" . $wpdb->escape($code) . "', starts = '" . $starts . "', expires = '" . $expires . "', uses = '" . intval($uses) . "' WHERE id = '" . $saveid . "' LIMIT 1";
46
+ if($wpdb->query($sqlQuery) !== false)
47
+ {
48
+ $pmpro_msg = __("Discount code updated successfully.", "pmpro");
49
+ $pmpro_msgt = "success";
50
+ $saved = true;
51
+ $edit = $saveid;
52
+ }
53
+ else
54
+ {
55
+ $pmpro_msg = __("Error updating discount code. That code may already be in use.", "pmpro");
56
+ $pmpro_msgt = "error";
57
+ }
58
+ }
59
+ else
60
+ {
61
+ $sqlQuery = "INSERT INTO $wpdb->pmpro_discount_codes (code, starts, expires, uses) VALUES('" . $wpdb->escape($code) . "', '" . $starts . "', '" . $expires . "', '" . intval($uses) . "')";
62
+ if($wpdb->query($sqlQuery) !== false)
63
+ {
64
+ $pmpro_msg = __("Discount code added successfully.", "pmpro");
65
+ $pmpro_msgt = "success";
66
+ $saved = true;
67
+ $edit = $wpdb->insert_id;
68
+ }
69
+ else
70
+ {
71
+ $pmpro_msg = __("Error adding discount code. That code may already be in use.", "pmpro") . $wpdb->last_error;
72
+ $pmpro_msgt = "error";
73
+ }
74
+ }
75
+
76
+ //now add the membership level rows
77
+ if($saved && $edit > 0)
78
+ {
79
+ //get the submitted values
80
+ $all_levels_a = $_REQUEST['all_levels'];
81
+ if(!empty($_REQUEST['levels']))
82
+ $levels_a = $_REQUEST['levels'];
83
+ else
84
+ $levels_a = array();
85
+ $initial_payment_a = $_REQUEST['initial_payment'];
86
+ if(!empty($_REQUEST['recurring']))
87
+ $recurring_a = $_REQUEST['recurring'];
88
+ $billing_amount_a = $_REQUEST['billing_amount'];
89
+ $cycle_number_a = $_REQUEST['cycle_number'];
90
+ $cycle_period_a = $_REQUEST['cycle_period'];
91
+ $billing_limit_a = $_REQUEST['billing_limit'];
92
+ if(!empty($_REQUEST['custom_trial']))
93
+ $custom_trial_a = $_REQUEST['custom_trial'];
94
+ $trial_amount_a = $_REQUEST['trial_amount'];
95
+ $trial_limit_a = $_REQUEST['trial_limit'];
96
+ if(!empty($_REQUEST['expiration']))
97
+ $expiration_a = $_REQUEST['expiration'];
98
+ $expiration_number_a = $_REQUEST['expiration_number'];
99
+ $expiration_period_a = $_REQUEST['expiration_period'];
100
+
101
+ //clear the old rows
102
+ $sqlQuery = "DELETE FROM $wpdb->pmpro_discount_codes_levels WHERE code_id = '" . $edit . "'";
103
+ $wpdb->query($sqlQuery);
104
+
105
+ //add a row for each checked level
106
+ if(!empty($levels_a))
107
+ {
108
+ foreach($levels_a as $level_id)
109
+ {
110
+ //get the values ready
111
+ $n = array_search($level_id, $all_levels_a); //this is the key location of this level's values
112
+ $initial_payment = $initial_payment_a[$n];
113
+
114
+ //is this recurring?
115
+ if(!empty($recurring_a))
116
+ {
117
+ if(in_array($level_id, $recurring_a))
118
+ $recurring = 1;
119
+ else
120
+ $recurring = 0;
121
+ }
122
+ else
123
+ $recurring = 0;
124
+
125
+ if(!empty($recurring))
126
+ {
127
+ $billing_amount = $billing_amount_a[$n];
128
+ $cycle_number = $cycle_number_a[$n];
129
+ $cycle_period = $cycle_period_a[$n];
130
+ $billing_limit = $billing_limit_a[$n];
131
+
132
+ //custom trial
133
+ if(!empty($custom_trial_a))
134
+ {
135
+ if(in_array($level_id, $custom_trial_a))
136
+ $custom_trial = 1;
137
+ else
138
+ $custom_trial = 0;
139
+ }
140
+ else
141
+ $custom_trial = 0;
142
+
143
+ if(!empty($custom_trial))
144
+ {
145
+ $trial_amount = $trial_amount_a[$n];
146
+ $trial_limit = $trial_limit_a[$n];
147
+ }
148
+ else
149
+ {
150
+ $trial_amount = '';
151
+ $trial_limit = '';
152
+ }
153
+ }
154
+ else
155
+ {
156
+ $billing_amount = '';
157
+ $cycle_number = '';
158
+ $cycle_period = 'Month';
159
+ $billing_limit = '';
160
+ $custom_trial = 0;
161
+ $trial_amount = '';
162
+ $trial_limit = '';
163
+ }
164
+
165
+ if(!empty($expiration_a))
166
+ {
167
+ if(in_array($level_id, $expiration_a))
168
+ $expiration = 1;
169
+ else
170
+ $expiration = 0;
171
+ }
172
+ else
173
+ $expiration = 0;
174
+
175
+ if(!empty($expiration))
176
+ {
177
+ $expiration_number = $expiration_number_a[$n];
178
+ $expiration_period = $expiration_period_a[$n];
179
+ }
180
+ else
181
+ {
182
+ $expiration_number = '';
183
+ $expiration_period = 'Month';
184
+ }
185
+
186
+ //okay, do the insert
187
+ $sqlQuery = "INSERT INTO $wpdb->pmpro_discount_codes_levels (code_id, level_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, expiration_number, expiration_period) VALUES('" . $wpdb->escape($edit) . "', '" . $wpdb->escape($level_id) . "', '" . (double)$wpdb->escape($initial_payment) . "', '" . (double)$wpdb->escape($billing_amount) . "', '" . intval($wpdb->escape($cycle_number)) . "', '" . $wpdb->escape($cycle_period) . "', '" . intval($wpdb->escape($billing_limit)) . "', '" . (double)$wpdb->escape($trial_amount) . "', '" . intval($wpdb->escape($trial_limit)) . "', '" . intval($wpdb->escape($expiration_number)) . "', '" . $wpdb->escape($expiration_period) . "')";
188
+
189
+ if($wpdb->query($sqlQuery) !== false)
190
+ {
191
+ //okay
192
+ do_action("pmpro_save_discount_code_level", $saveid, $level_id);
193
+ }
194
+ else
195
+ {
196
+ $level_errors[] = sprintf(__("Error saving values for the %s level.", "pmpro"), $wpdb->get_var("SELECT name FROM $wpdb->pmpro_membership_levels WHERE id = '" . $level_id . "' LIMIT 1"));
197
+ }
198
+ }
199
+ }
200
+
201
+ //errors?
202
+ if(!empty($level_errors))
203
+ {
204
+ $pmpro_msg = __("There were errors updating the level values: ", "pmpro") . implode(" ", $level_errors);
205
+ $pmpro_msgt = "error";
206
+ }
207
+ else
208
+ {
209
+ //all good. set edit = NULL so we go back to the overview page
210
+ $edit = NULL;
211
+
212
+ do_action("pmpro_save_discount_code", $saveid);
213
+ }
214
+ }
215
+ }
216
+
217
+ //are we deleting?
218
+ if(!empty($delete))
219
+ {
220
+ //is this a code?
221
+ $code = $wpdb->get_var("SELECT code FROM $wpdb->pmpro_discount_codes WHERE id = '" . $delete . "' LIMIT 1");
222
+ if(!empty($code))
223
+ {
224
+ //delete the code levels
225
+ $r1 = $wpdb->query("DELETE FROM $wpdb->pmpro_discount_codes_levels WHERE code_id = '" . $delete . "'");
226
+
227
+ if($r1 !== false)
228
+ {
229
+ //delete the code
230
+ $r2 = $wpdb->query("DELETE FROM $wpdb->pmpro_discount_codes WHERE id = '" . $delete . "' LIMIT 1");
231
+
232
+ if($r2 !== false)
233
+ {
234
+ $pmpro_msg = sprintf(__("Code %s deleted successfully.", "pmpro"), $code);
235
+ $pmpro_msgt = "success";
236
+ }
237
+ else
238
+ {
239
+ $pmpro_msg = __("Error deleting discount code. The code was only partially deleted. Please try again.", "pmpro");
240
+ $pmpro_msgt = "error";
241
+ }
242
+ }
243
+ else
244
+ {
245
+ $pmpro_msg = __("Error deleting code. Please try again.", "pmpro");
246
+ $pmpro_msgt = "error";
247
+ }
248
+ }
249
+ else
250
+ {
251
+ $pmpro_msg = __("Code not found.", "pmpro");
252
+ $pmpro_msgt = "error";
253
+ }
254
+ }
255
+
256
+ require_once(dirname(__FILE__) . "/admin_header.php");
257
+ ?>
258
+
259
+ <?php if($edit) { ?>
260
+
261
+ <h2>
262
+ <?php
263
+ if($edit > 0)
264
+ echo __("Edit Discount Code", "pmpro");
265
+ else
266
+ echo __("Add New Discount Code", "pmpro");
267
+ ?>
268
+ </h2>
269
+
270
+ <?php if(!empty($pmpro_msg)) { ?>
271
+ <div id="message" class="<?php if($pmpro_msgt == "success") echo "updated fade"; else echo "error"; ?>"><p><?php echo $pmpro_msg?></p></div>
272
+ <?php } ?>
273
+
274
+ <div>
275
+ <?php
276
+ // get the code...
277
+ if($edit > 0)
278