Paid Memberships Pro - Version 1.8

Version Description

  • ENHANCEMENT: Payment gateway classes updated so all settings and checkout fields are processed via the gateway class file. This will make it easier to maintain, update, and add new gateways.
  • ENHANCEMENT: Added a pmpro_after_membership_level_profile_fields hook after the "Membership Level" field dropdown on the edit profile page.
  • ENHANCEMENT: Added new statuses for orders when cancelled. cancelled
Download this release

Release Info

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

Code changes from version 1.7.15.2 to 1.8

Files changed (118) hide show
  1. adminpages/addons/images/pmpro-mailchimp.jpg +0 -0
  2. adminpages/addons/pmpro-woocommerce.php +1 -1
  3. adminpages/admin_header.php +156 -156
  4. adminpages/discountcodes.php +2 -1
  5. adminpages/functions.php +68 -31
  6. adminpages/membershiplevels.php +32 -53
  7. adminpages/memberslist-csv.php +64 -57
  8. adminpages/memberslist.php +37 -9
  9. adminpages/orders.php +181 -163
  10. adminpages/paymentsettings.php +97 -393
  11. classes/class.memberorder.php +214 -131
  12. classes/gateways/class.pmprogateway_authorizenet.php +116 -0
  13. classes/gateways/class.pmprogateway_braintree.php +348 -3
  14. classes/gateways/class.pmprogateway_check.php +135 -2
  15. classes/gateways/class.pmprogateway_cybersource.php +126 -6
  16. classes/gateways/class.pmprogateway_payflowpro.php +141 -3
  17. classes/gateways/class.pmprogateway_paypal.php +224 -4
  18. classes/gateways/class.pmprogateway_paypalexpress.php +432 -4
  19. classes/gateways/class.pmprogateway_paypalstandard.php +240 -4
  20. classes/gateways/class.pmprogateway_stripe.php +1282 -113
  21. classes/gateways/class.pmprogateway_twocheckout.php +219 -3
  22. css/admin.css +19 -2
  23. css/frontend.css +4 -1
  24. includes/adminpages.php +45 -3
  25. includes/content.php +13 -7
  26. includes/currencies.php +5 -1
  27. includes/functions.php +361 -288
  28. includes/lib/recaptchalib.php +101 -235
  29. includes/localization.php +23 -8
  30. includes/profile.php +116 -53
  31. includes/recaptcha.php +27 -1
  32. includes/upgradecheck.php +1 -1
  33. languages/email/de_DE/admin_change.html +7 -0
  34. languages/email/de_DE/admin_change_admin.html +5 -0
  35. languages/email/de_DE/billing.html +16 -0
  36. languages/email/de_DE/billing_admin.html +17 -0
  37. languages/email/de_DE/billing_failure.html +11 -0
  38. languages/email/de_DE/billing_failure_admin.html +11 -0
  39. languages/email/de_DE/cancel.html +3 -0
  40. languages/email/de_DE/cancel_admin.html +8 -0
  41. languages/email/de_DE/checkout_check.html +17 -0
  42. languages/email/de_DE/checkout_check_admin.html +17 -0
  43. languages/email/de_DE/checkout_express.html +14 -0
  44. languages/email/de_DE/checkout_express_admin.html +14 -0
  45. languages/email/de_DE/checkout_free.html +8 -0
  46. languages/email/de_DE/checkout_free_admin.html +8 -0
  47. languages/email/de_DE/checkout_freetrial.html +19 -0
  48. languages/email/de_DE/checkout_freetrial_admin.html +19 -0
  49. languages/email/de_DE/checkout_paid.html +23 -0
  50. languages/email/de_DE/checkout_paid_admin.html +23 -0
  51. languages/email/de_DE/checkout_trial.html +23 -0
  52. languages/email/de_DE/checkout_trial_admin.html +23 -0
  53. languages/email/de_DE/credit_card_expiring.html +13 -0
  54. languages/email/de_DE/default.html +1 -0
  55. languages/email/de_DE/footer.html +4 -0
  56. languages/email/de_DE/header.html +1 -0
  57. languages/email/de_DE/invoice.html +19 -0
  58. languages/email/de_DE/membership_expired.html +7 -0
  59. languages/email/de_DE/membership_expiring.html +6 -0
  60. languages/email/de_DE/trial_ending.html +8 -0
  61. languages/email/nl_NL/admin_change.html +7 -0
  62. languages/email/nl_NL/admin_change_admin.html +5 -0
  63. languages/email/nl_NL/billing.html +16 -0
  64. languages/email/nl_NL/billing_admin.html +17 -0
  65. languages/email/nl_NL/billing_failure.html +11 -0
  66. languages/email/nl_NL/billing_failure_admin.html +11 -0
  67. languages/email/nl_NL/cancel.html +3 -0
  68. languages/email/nl_NL/cancel_admin.html +8 -0
  69. languages/email/nl_NL/checkout_check.html +17 -0
  70. languages/email/nl_NL/checkout_check_admin.html +17 -0
  71. languages/email/nl_NL/checkout_express.html +14 -0
  72. languages/email/nl_NL/checkout_express_admin.html +14 -0
  73. languages/email/nl_NL/checkout_free.html +8 -0
  74. languages/email/nl_NL/checkout_free_admin.html +8 -0
  75. languages/email/nl_NL/checkout_freetrial.html +19 -0
  76. languages/email/nl_NL/checkout_freetrial_admin.html +19 -0
  77. languages/email/nl_NL/checkout_paid.html +23 -0
  78. languages/email/nl_NL/checkout_paid_admin.html +26 -0
  79. languages/email/nl_NL/checkout_trial.html +23 -0
  80. languages/email/nl_NL/checkout_trial_admin.html +24 -0
  81. languages/email/nl_NL/credit_card_expiring.html +11 -0
  82. languages/email/nl_NL/default.html +1 -0
  83. languages/email/nl_NL/footer.html +4 -0
  84. languages/email/nl_NL/header.html +1 -0
  85. languages/email/nl_NL/invoice.html +19 -0
  86. languages/email/nl_NL/membership_expired.html +7 -0
  87. languages/email/nl_NL/membership_expiring.html +6 -0
  88. languages/email/nl_NL/trial_ending.html +8 -0
  89. languages/pages/de_DE/popup-cvv.html +55 -0
  90. languages/pmpro-de_DE.mo +0 -0
  91. languages/pmpro-de_DE.po +3520 -0
  92. languages/pmpro-es_ES.mo +0 -0
  93. languages/pmpro-es_ES.po +16 -0
  94. languages/pmpro-fr_FR.mo +0 -0
  95. languages/pmpro-fr_FR.po +16 -0
  96. languages/pmpro-nl_NL.mo +0 -0
  97. languages/pmpro-nl_NL.po +3487 -0
  98. languages/pmpro.mo +0 -0
  99. languages/pmpro.po +1711 -967
  100. languages/pmpro.pot +1711 -967
  101. pages/account.php +92 -119
  102. pages/cancel.php +90 -23
  103. pages/checkout.php +167 -175
  104. pages/invoice.php +8 -8
  105. pages/levels.php +1 -1
  106. pages/popup-cvv.html +2 -2
  107. paid-memberships-pro.php +51 -11
  108. preheaders/cancel.php +39 -39
  109. preheaders/checkout.php +727 -1005
  110. readme.txt +36 -10
  111. scheduled/crons.php +190 -193
  112. services/authnet-silent-post.php +4 -1
  113. services/braintree-webhook.php +4 -1
  114. services/getfile.php +1 -0
  115. services/ipnhandler.php +9 -2
  116. services/stripe-webhook.php +93 -14
  117. services/twocheckout-ins.php +4 -1
  118. shortcodes/membership.php +17 -12
adminpages/addons/images/pmpro-mailchimp.jpg CHANGED
Binary file
adminpages/addons/pmpro-woocommerce.php CHANGED
@@ -16,7 +16,7 @@ function pmpro_addon_pmpro_woocommerce_widget($addon)
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>
16
?>
17
<img class="addon-thumb" src="<?php echo PMPRO_URL?>/adminpages/addons/images/pmpro-woocommerce.gif" />
18
<div class="info">
19
+ <p>Use <a href="http://www.woothemes.com/woocommerce/">WooCommerce</a> to purchase membership levels 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>
adminpages/admin_header.php CHANGED
@@ -1,156 +1,156 @@
1
- <?php
2
- require_once(dirname(__FILE__) . "/functions.php");
3
-
4
- if(isset($_REQUEST['page']))
5
- $view = $_REQUEST['page'];
6
- else
7
- $view = "";
8
-
9
- global $pmpro_ready, $msg, $msgt;
10
- $pmpro_ready = pmpro_is_ready();
11
- if(!$pmpro_ready)
12
- {
13
- global $pmpro_level_ready, $pmpro_gateway_ready, $pmpro_pages_ready;
14
- if(!isset($edit))
15
- {
16
- if(isset($_REQUEST['edit']))
17
- $edit = $_REQUEST['edit'];
18
- else
19
- $edit = false;
20
- }
21
-
22
- if(empty($msg))
23
- $msg = -1;
24
- if(empty($pmpro_level_ready) && empty($edit))
25
- $msgt .= " <a href=\"?page=pmpro-membershiplevels&edit=-1\">" . __("Add a membership level to get started.", "pmpro") . "</a>";
26
- elseif($pmpro_level_ready && !$pmpro_pages_ready && $view != "pmpro-pagesettings")
27
- $msgt .= " <a href=\"?page=pmpro-pagesettings\">" . __("Setup the membership pages", "pmpro") . "</a>.";
28
- elseif($pmpro_level_ready && $pmpro_pages_ready && !$pmpro_gateway_ready && $view != "pmpro-paymentsettings")
29
- $msgt .= " <a href=\"?page=pmpro-paymentsettings\">" . __("Setup your SSL certificate and payment gateway", "pmpro") . "</a>.";
30
-
31
- if(empty($msgt))
32
- $msg = false;
33
- }
34
-
35
- if(!pmpro_checkLevelForStripeCompatibility())
36
- {
37
- $msg = -1;
38
- $msgt = __("The billing details for some of your membership levels is not supported by Stripe.", "pmpro");
39
- if($view == "pmpro-membershiplevels" && !empty($_REQUEST['edit']) && $_REQUEST['edit'] > 0)
40
- {
41
- if(!pmpro_checkLevelForStripeCompatibility($_REQUEST['edit']))
42
- {
43
- global $pmpro_stripe_error;
44
- $pmpro_stripe_error = true;
45
- $msg = -1;
46
- $msgt = __("The billing details for this level are not supported by Stripe. Please review the notes in the Billing Details section below.", "pmpro");
47
- }
48
- }
49
- elseif($view == "pmpro-membershiplevels")
50
- $msgt .= " " . __("The levels with issues are highlighted below.", "pmpro");
51
- else
52
- $msgt .= " <a href=\"?page=pmpro-membershiplevels\">" . __("Please edit your levels", "pmpro") . "</a>.";
53
- }
54
-
55
- if(!pmpro_checkLevelForPayflowCompatibility())
56
- {
57
- $msg = -1;
58
- $msgt = __("The billing details for some of your membership levels is not supported by Payflow.", "pmpro");
59
- if($view == "pmpro-membershiplevels" && !empty($_REQUEST['edit']) && $_REQUEST['edit'] > 0)
60
- {
61
- if(!pmpro_checkLevelForPayflowCompatibility($_REQUEST['edit']))
62
- {
63
- global $pmpro_payflow_error;
64
- $pmpro_payflow_error = true;
65
- $msg = -1;
66
- $msgt = __("The billing details for this level are not supported by Payflow. Please review the notes in the Billing Details section below.", "pmpro");
67
- }
68
- }
69
- elseif($view == "pmpro-membershiplevels")
70
- $msgt .= " " . __("The levels with issues are highlighted below.", "pmpro");
71
- else
72
- $msgt .= " <a href=\"?page=pmpro-membershiplevels\">" . __("Please edit your levels", "pmpro") . "</a>.";
73
- }
74
-
75
- if(!pmpro_checkLevelForBraintreeCompatibility())
76
- {
77
- $msg = -1;
78
- $msgt = __("The billing details for some of your membership levels is not supported by Braintree.", "pmpro");
79
- if($view == "pmpro-membershiplevels" && !empty($_REQUEST['edit']) && $_REQUEST['edit'] > 0)
80
- {
81
- if(!pmpro_checkLevelForBraintreeCompatibility($_REQUEST['edit']))
82
- {
83
- global $pmpro_braintree_error;
84
- $pmpro_braintree_error = true;
85
- $msg = -1;
86
- $msgt = __("The billing details for this level are not supported by Braintree. Please review the notes in the Billing Details section below.", "pmpro");
87
- }
88
- }
89
- elseif($view == "pmpro-membershiplevels")
90
- $msgt .= " " . __("The levels with issues are highlighted below.", "pmpro");
91
- else
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
- ?>
119
- <div id="message" class="<?php if($msg > 0) echo "updated fade"; else echo "error"; ?>"><p><?php echo $msgt?></p></div>
120
- <?php
121
- }
122
-
123
- ?>
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>
131
-
132
- <div id="pmpro_notifications">
133
- </div>
134
- <script>
135
- jQuery(document).ready(function() {
136
- jQuery.get('<?php echo get_admin_url(NULL, "/admin-ajax.php?action=pmpro_notifications"); ?>', function(data) {
137
- if(data && data != 'NULL')
138
- jQuery('#pmpro_notifications').html(data);
139
- });
140
- });
141
- </script>
142
-
143
- <?php
144
- $settings_tabs = array("pmpro-membershiplevels", "pmpro-pagesettings", "pmpro-paymentsettings", "pmpro-emailsettings", "pmpro-advancedsettings", "pmpro-addons");
145
- if(in_array($view, $settings_tabs))
146
- {
147
- ?>
148
- <h3 class="nav-tab-wrapper">
149
- <a href="admin.php?page=pmpro-membershiplevels" class="nav-tab<?php if($view == 'pmpro-membershiplevels') { ?> nav-tab-active<?php } ?>"><?php _e('Membership Levels', 'pmpro');?></a>
150
- <a href="admin.php?page=pmpro-pagesettings" class="nav-tab<?php if($view == 'pmpro-pagesettings') { ?> nav-tab-active<?php } ?>"><?php _e('Pages', 'pmpro');?></a>
151
- <a href="admin.php?page=pmpro-paymentsettings" class="nav-tab<?php if($view == 'pmpro-paymentsettings') { ?> nav-tab-active<?php } ?>"><?php _e('Payment Gateway &amp; SSL', 'pmpro');?></a>
152
- <a href="admin.php?page=pmpro-emailsettings" class="nav-tab<?php if($view == 'pmpro-emailsettings') { ?> nav-tab-active<?php } ?>"><?php _e('Email', 'pmpro');?></a>
153
- <a href="admin.php?page=pmpro-advancedsettings" class="nav-tab<?php if($view == 'pmpro-advancedsettings') { ?> nav-tab-active<?php } ?>"><?php _e('Advanced', 'pmpro');?></a>
154
- <a href="admin.php?page=pmpro-addons" class="nav-tab<?php if($view == 'pmpro-addons') { ?> nav-tab-active<?php } ?>"><?php _e('Add Ons', 'pmpro');?></a>
155
- </h3>
156
- <?php } ?>
1
+ <?php
2
+ require_once(dirname(__FILE__) . "/functions.php");
3
+
4
+ if(isset($_REQUEST['page']))
5
+ $view = $_REQUEST['page'];
6
+ else
7
+ $view = "";
8
+
9
+ global $pmpro_ready, $msg, $msgt;
10
+ $pmpro_ready = pmpro_is_ready();
11
+ if(!$pmpro_ready)
12
+ {
13
+ global $pmpro_level_ready, $pmpro_gateway_ready, $pmpro_pages_ready;
14
+ if(!isset($edit))
15
+ {
16
+ if(isset($_REQUEST['edit']))
17
+ $edit = $_REQUEST['edit'];
18
+ else
19
+ $edit = false;
20
+ }
21
+
22
+ if(empty($msg))
23
+ $msg = -1;
24
+ if(empty($pmpro_level_ready) && empty($edit))
25
+ $msgt .= " <a href=\"?page=pmpro-membershiplevels&edit=-1\">" . __("Add a membership level to get started.", "pmpro") . "</a>";
26
+ elseif($pmpro_level_ready && !$pmpro_pages_ready && $view != "pmpro-pagesettings")
27
+ $msgt .= " <a href=\"?page=pmpro-pagesettings\">" . __("Setup the membership pages", "pmpro") . "</a>.";
28
+ elseif($pmpro_level_ready && $pmpro_pages_ready && !$pmpro_gateway_ready && $view != "pmpro-paymentsettings")
29
+ $msgt .= " <a href=\"?page=pmpro-paymentsettings\">" . __("Setup your SSL certificate and payment gateway", "pmpro") . "</a>.";
30
+
31
+ if(empty($msgt))
32
+ $msg = false;
33
+ }
34
+
35
+ if(!pmpro_checkLevelForStripeCompatibility())
36
+ {
37
+ $msg = -1;
38
+ $msgt = __("The billing details for some of your membership levels is not supported by Stripe.", "pmpro");
39
+ if($view == "pmpro-membershiplevels" && !empty($_REQUEST['edit']) && $_REQUEST['edit'] > 0)
40
+ {
41
+ if(!pmpro_checkLevelForStripeCompatibility($_REQUEST['edit']))
42
+ {
43
+ global $pmpro_stripe_error;
44
+ $pmpro_stripe_error = true;
45
+ $msg = -1;
46
+ $msgt = __("The billing details for this level are not supported by Stripe. Please review the notes in the Billing Details section below.", "pmpro");
47
+ }
48
+ }
49
+ elseif($view == "pmpro-membershiplevels")
50
+ $msgt .= " " . __("The levels with issues are highlighted below.", "pmpro");
51
+ else
52
+ $msgt .= " <a href=\"?page=pmpro-membershiplevels\">" . __("Please edit your levels", "pmpro") . "</a>.";
53
+ }
54
+
55
+ if(!pmpro_checkLevelForPayflowCompatibility())
56
+ {
57
+ $msg = -1;
58
+ $msgt = __("The billing details for some of your membership levels is not supported by Payflow.", "pmpro");
59
+ if($view == "pmpro-membershiplevels" && !empty($_REQUEST['edit']) && $_REQUEST['edit'] > 0)
60
+ {
61
+ if(!pmpro_checkLevelForPayflowCompatibility($_REQUEST['edit']))
62
+ {
63
+ global $pmpro_payflow_error;
64
+ $pmpro_payflow_error = true;
65
+ $msg = -1;
66
+ $msgt = __("The billing details for this level are not supported by Payflow. Please review the notes in the Billing Details section below.", "pmpro");
67
+ }
68
+ }
69
+ elseif($view == "pmpro-membershiplevels")
70
+ $msgt .= " " . __("The levels with issues are highlighted below.", "pmpro");
71
+ else
72
+ $msgt .= " <a href=\"?page=pmpro-membershiplevels\">" . __("Please edit your levels", "pmpro") . "</a>.";
73
+ }
74
+
75
+ if(!pmpro_checkLevelForBraintreeCompatibility())
76
+ {
77
+ $msg = -1;
78
+ $msgt = __("The billing details for some of your membership levels is not supported by Braintree.", "pmpro");
79
+ if($view == "pmpro-membershiplevels" && !empty($_REQUEST['edit']) && $_REQUEST['edit'] > 0)
80
+ {
81
+ if(!pmpro_checkLevelForBraintreeCompatibility($_REQUEST['edit']))
82
+ {
83
+ global $pmpro_braintree_error;
84
+ $pmpro_braintree_error = true;
85
+ $msg = -1;
86
+ $msgt = __("The billing details for this level are not supported by Braintree. Please review the notes in the Billing Details section below.", "pmpro");
87
+ }
88
+ }
89
+ elseif($view == "pmpro-membershiplevels")
90
+ $msgt .= " " . __("The levels with issues are highlighted below.", "pmpro");
91
+ else
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
+ ?>
119
+ <div id="message" class="<?php if($msg > 0) echo "updated fade"; else echo "error"; ?>"><p><?php echo $msgt?></p></div>
120
+ <?php
121
+ }
122
+
123
+ ?>
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>
131
+
132
+ <div id="pmpro_notifications">
133
+ </div>
134
+ <script>
135
+ jQuery(document).ready(function() {
136
+ jQuery.get('<?php echo get_admin_url(NULL, "/admin-ajax.php?action=pmpro_notifications"); ?>', function(data) {
137
+ if(data && data != 'NULL')
138
+ jQuery('#pmpro_notifications').html(data);
139
+ });
140
+ });
141
+ </script>
142
+
143
+ <?php
144
+ $settings_tabs = array("pmpro-membershiplevels", "pmpro-pagesettings", "pmpro-paymentsettings", "pmpro-emailsettings", "pmpro-advancedsettings", "pmpro-addons");
145
+ if(in_array($view, $settings_tabs))
146
+ {
147
+ ?>
148
+ <h2 class="nav-tab-wrapper">
149
+ <a href="admin.php?page=pmpro-membershiplevels" class="nav-tab<?php if($view == 'pmpro-membershiplevels') { ?> nav-tab-active<?php } ?>"><?php _e('Membership Levels', 'pmpro');?></a>
150
+ <a href="admin.php?page=pmpro-pagesettings" class="nav-tab<?php if($view == 'pmpro-pagesettings') { ?> nav-tab-active<?php } ?>"><?php _e('Pages', 'pmpro');?></a>
151
+ <a href="admin.php?page=pmpro-paymentsettings" class="nav-tab<?php if($view == 'pmpro-paymentsettings') { ?> nav-tab-active<?php } ?>"><?php _e('Payment Gateway &amp; SSL', 'pmpro');?></a>
152
+ <a href="admin.php?page=pmpro-emailsettings" class="nav-tab<?php if($view == 'pmpro-emailsettings') { ?> nav-tab-active<?php } ?>"><?php _e('Email', 'pmpro');?></a>
153
+ <a href="admin.php?page=pmpro-advancedsettings" class="nav-tab<?php if($view == 'pmpro-advancedsettings') { ?> nav-tab-active<?php } ?>"><?php _e('Advanced', 'pmpro');?></a>
154
+ <a href="admin.php?page=pmpro-addons" class="nav-tab<?php if($view == 'pmpro-addons') { ?> nav-tab-active<?php } ?>"><?php _e('Add Ons', 'pmpro');?></a>
155
+ </h2>
156
+ <?php } ?>
adminpages/discountcodes.php CHANGED
@@ -65,6 +65,7 @@
65
$pmpro_msgt = "success";
66
$saved = true;
67
$edit = $wpdb->insert_id;
68
}
69
else
70
{
@@ -608,7 +609,7 @@
608
foreach($codes as $code)
609
{
610
?>
611
- <tr>
612
<td><?php echo $code->id?></td>
613
<td>
614
<a href="?page=pmpro-discountcodes&edit=<?php echo $code->id?>"><?php echo $code->code?></a>
65
$pmpro_msgt = "success";
66
$saved = true;
67
$edit = $wpdb->insert_id;
68
+ //$saveid = $edit;
69
}
70
else
71
{
609
foreach($codes as $code)
610
{
611
?>
612
+ <tr<?php if($count++ % 2 == 1) { ?> class="alternate"<?php } ?>>
613
<td><?php echo $code->id?></td>
614
<td>
615
<a href="?page=pmpro-discountcodes&edit=<?php echo $code->id?>"><?php echo $code->code?></a>
adminpages/functions.php CHANGED
@@ -2,17 +2,17 @@
2
/****************************************************************
3
4
IMPORTANT. PLEASE READ.
5
-
6
DO NOT EDIT THIS FILE or any other file in the /wp-content/plugins/paid-memberships-pro/ directory.
7
Doing so could break the PMPro plugin and/or keep you from upgrading this plugin in the future.
8
We regularly release updates to the plugin, including important security fixes and new features.
9
You want to be able to upgrade.
10
-
11
If you were asked to insert code into "your functions.php file", it was meant that you edit the functions.php
12
in the root folder of your active theme. e.g. /wp-content/themes/twentytwelve/functions.php
13
You can also create a custom plugin to place customization code into. Instructions are here:
14
http://www.paidmembershipspro.com/2012/08/create-a-plugin-for-pmpro-customizations/
15
-
16
Further documentation for customizing Paid Memberships Pro can be found here:
17
http://www.paidmembershipspro.com/documentation/
18
@@ -27,23 +27,21 @@ function pmpro_checkLevelForStripeCompatibility($level = NULL)
27
if($gateway == "stripe")
28
{
29
global $wpdb;
30
-
31
//check ALL the levels
32
if(empty($level))
33
{
34
- $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ORDER BY id ASC";
35
$levels = $wpdb->get_results($sqlQuery, OBJECT);
36
if(!empty($levels))
37
{
38
foreach($levels as $level)
39
{
40
/*
41
- Stripe currently does not support:
42
- * Trial Amounts > 0.
43
- * Billing Limits.
44
*/
45
- if($level->trial_amount > 0 ||
46
- $level->billing_limit > 0)
47
{
48
return false;
49
}
@@ -55,17 +53,16 @@ function pmpro_checkLevelForStripeCompatibility($level = NULL)
55
//need to look it up?
56
if(is_numeric($level))
57
$level = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = '" . esc_sql($level) . "' LIMIT 1");
58
-
59
//check this level
60
- if($level->trial_amount > 0 ||
61
- ($level->cycle_number > 0 && $level->cycle_period == "Day") ||
62
$level->billing_limit > 0)
63
{
64
return false;
65
}
66
}
67
}
68
-
69
return true;
70
}
71
@@ -78,11 +75,11 @@ function pmpro_checkLevelForPayflowCompatibility($level = NULL)
78
if($gateway == "payflowpro")
79
{
80
global $wpdb;
81
-
82
//check ALL the levels
83
if(empty($level))
84
{
85
- $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ORDER BY id ASC";
86
$levels = $wpdb->get_results($sqlQuery, OBJECT);
87
if(!empty($levels))
88
{
@@ -91,9 +88,9 @@ function pmpro_checkLevelForPayflowCompatibility($level = NULL)
91
/*
92
Payflow currently does not support:
93
* Trial Amounts > 0.
94
- * Daily billing periods.
95
*/
96
-
97
if($level->trial_amount > 0 ||
98
$level->cycle_number > 1)
99
{
@@ -103,11 +100,11 @@ function pmpro_checkLevelForPayflowCompatibility($level = NULL)
103
}
104
}
105
else
106
- {
107
//need to look it up?
108
if(is_numeric($level))
109
$level = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = '" . esc_sql($level) . "' LIMIT 1");
110
-
111
//check this level
112
if($level->trial_amount > 0 ||
113
$level->cycle_number > 1 ||
@@ -117,7 +114,7 @@ function pmpro_checkLevelForPayflowCompatibility($level = NULL)
117
}
118
}
119
}
120
-
121
return true;
122
}
123
@@ -130,11 +127,11 @@ function pmpro_checkLevelForBraintreeCompatibility($level = NULL)
130
if($gateway == "braintree")
131
{
132
global $wpdb;
133
-
134
//check ALL the levels
135
if(empty($level))
136
{
137
- $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ORDER BY id ASC";
138
$levels = $wpdb->get_results($sqlQuery, OBJECT);
139
if(!empty($levels))
140
{
@@ -143,7 +140,7 @@ function pmpro_checkLevelForBraintreeCompatibility($level = NULL)
143
/*
144
Braintree currently does not support:
145
* Trial Amounts > 0.
146
- * Daily or Weekly billing periods.
147
*/
148
if($level->trial_amount > 0 ||
149
($level->cycle_number > 0 && ($level->cycle_period == "Day" || $level->cycle_period == "Week")))
@@ -158,7 +155,7 @@ function pmpro_checkLevelForBraintreeCompatibility($level = NULL)
158
//need to look it up?
159
if(is_numeric($level))
160
$level = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = '" . esc_sql($level) . "' LIMIT 1");
161
-
162
//check this level
163
if($level->trial_amount > 0 ||
164
($level->cycle_number > 0 && ($level->cycle_period == "Day" || $level->cycle_period == "Week")))
@@ -167,7 +164,7 @@ function pmpro_checkLevelForBraintreeCompatibility($level = NULL)
167
}
168
}
169
}
170
-
171
return true;
172
}
173
@@ -180,11 +177,11 @@ function pmpro_checkLevelForTwoCheckoutCompatibility($level = NULL)
180
if($gateway == "twocheckout")
181
{
182
global $wpdb;
183
-
184
//check ALL the levels
185
if(empty($level))
186
{
187
- $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ORDER BY id ASC";
188
$levels = $wpdb->get_results($sqlQuery, OBJECT);
189
if(!empty($levels))
190
{
@@ -192,7 +189,7 @@ function pmpro_checkLevelForTwoCheckoutCompatibility($level = NULL)
192
{
193
/*
194
2Checkout currently does not support:
195
- * Trial amounts less than or greater than the absolute value of amonthly recurring amount.
196
*/
197
if(pmpro_isLevelTrial($level))
198
{
@@ -206,7 +203,7 @@ function pmpro_checkLevelForTwoCheckoutCompatibility($level = NULL)
206
//need to look it up?
207
if(is_numeric($level))
208
$level = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = '" . esc_sql($level) . "' LIMIT 1");
209
-
210
//check this level
211
if(pmpro_isLevelTrial($level))
212
{
@@ -214,6 +211,46 @@ function pmpro_checkLevelForTwoCheckoutCompatibility($level = NULL)
214
}
215
}
216
}
217
-
218
return true;
219
}
2
/****************************************************************
3
4
IMPORTANT. PLEASE READ.
5
+
6
DO NOT EDIT THIS FILE or any other file in the /wp-content/plugins/paid-memberships-pro/ directory.
7
Doing so could break the PMPro plugin and/or keep you from upgrading this plugin in the future.
8
We regularly release updates to the plugin, including important security fixes and new features.
9
You want to be able to upgrade.
10
+
11
If you were asked to insert code into "your functions.php file", it was meant that you edit the functions.php
12
in the root folder of your active theme. e.g. /wp-content/themes/twentytwelve/functions.php
13
You can also create a custom plugin to place customization code into. Instructions are here:
14
http://www.paidmembershipspro.com/2012/08/create-a-plugin-for-pmpro-customizations/
15
+
16
Further documentation for customizing Paid Memberships Pro can be found here:
17
http://www.paidmembershipspro.com/documentation/
18
27
if($gateway == "stripe")
28
{
29
global $wpdb;
30
+
31
//check ALL the levels
32
if(empty($level))
33
{
34
+ $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ORDER BY id ASC";
35
$levels = $wpdb->get_results($sqlQuery, OBJECT);
36
if(!empty($levels))
37
{
38
foreach($levels as $level)
39
{
40
/*
41
+ Stripe currently does not support:
42
+ * Billing Limits.
43
*/
44
+ if($level->billing_limit > 0)
45
{
46
return false;
47
}
53
//need to look it up?
54
if(is_numeric($level))
55
$level = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = '" . esc_sql($level) . "' LIMIT 1");
56
+
57
//check this level
58
+ if(($level->cycle_number > 0 && $level->cycle_period == "Day") ||
59
$level->billing_limit > 0)
60
{
61
return false;
62
}
63
}
64
}
65
+
66
return true;
67
}
68
75
if($gateway == "payflowpro")
76
{
77
global $wpdb;
78
+
79
//check ALL the levels
80
if(empty($level))
81
{
82
+ $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ORDER BY id ASC";
83
$levels = $wpdb->get_results($sqlQuery, OBJECT);
84
if(!empty($levels))
85
{
88
/*
89
Payflow currently does not support:
90
* Trial Amounts > 0.
91
+ * Daily billing periods.
92
*/
93
+
94
if($level->trial_amount > 0 ||
95
$level->cycle_number > 1)
96
{
100
}
101
}
102
else
103
+ {
104
//need to look it up?
105
if(is_numeric($level))
106
$level = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = '" . esc_sql($level) . "' LIMIT 1");
107
+
108
//check this level
109
if($level->trial_amount > 0 ||
110
$level->cycle_number > 1 ||
114
}
115
}
116
}
117
+
118
return true;
119
}
120
127
if($gateway == "braintree")
128
{
129
global $wpdb;
130
+
131
//check ALL the levels
132
if(empty($level))
133
{
134
+ $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ORDER BY id ASC";
135
$levels = $wpdb->get_results($sqlQuery, OBJECT);
136
if(!empty($levels))
137
{
140
/*
141
Braintree currently does not support:
142
* Trial Amounts > 0.
143
+ * Daily or Weekly billing periods.
144
*/
145
if($level->trial_amount > 0 ||
146
($level->cycle_number > 0 && ($level->cycle_period == "Day" || $level->cycle_period == "Week")))
155
//need to look it up?
156
if(is_numeric($level))
157
$level = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = '" . esc_sql($level) . "' LIMIT 1");
158
+
159
//check this level
160
if($level->trial_amount > 0 ||
161
($level->cycle_number > 0 && ($level->cycle_period == "Day" || $level->cycle_period == "Week")))
164
}
165
}
166
}
167
+
168
return true;
169
}
170
177
if($gateway == "twocheckout")
178
{
179
global $wpdb;
180
+
181
//check ALL the levels
182
if(empty($level))
183
{
184
+ $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ORDER BY id ASC";
185
$levels = $wpdb->get_results($sqlQuery, OBJECT);
186
if(!empty($levels))
187
{
189
{
190
/*
191
2Checkout currently does not support:
192
+ * Trial amounts less than or greater than the absolute value of amonthly recurring amount.
193
*/
194
if(pmpro_isLevelTrial($level))
195
{
203
//need to look it up?
204
if(is_numeric($level))
205
$level = $wpdb->get_row("SELECT * FROM $wpdb->pmpro_membership_levels WHERE id = '" . esc_sql($level) . "' LIMIT 1");
206
+
207
//check this level
208
if(pmpro_isLevelTrial($level))
209
{
211
}
212
}
213
}
214
+
215
return true;
216
+ }
217
+
218
+ /**
219
+ * Get the gateway-related classes for fields on the payment settings page.
220
+ *
221
+ * @param string $field The name of the field to check.
222
+ * @param bool $force If true, it will rebuild the cached results.
223
+ *
224
+ * @since 2.0
225
+ */
226
+ function pmpro_getClassesForPaymentSettingsField($field, $force = false)
227
+ {
228
+ global $pmpro_gateway_options;
229
+ $pmpro_gateways = pmpro_gateways();
230
+
231
+ //build array of gateways and options
232
+ if(!isset($pmpro_gateway_options) || $force)
233
+ {
234
+ $pmpro_gateway_options = array();
235
+
236
+ foreach($pmpro_gateways as $gateway => $label)
237
+ {
238
+ //get options
239
+ if(class_exists('PMProGateway_' . $gateway) && method_exists('PMProGateway_' . $gateway, 'getGatewayOptions'))
240
+ {
241
+ $pmpro_gateway_options[$gateway] = call_user_func(array('PMProGateway_' . $gateway, 'getGatewayOptions'));
242
+ }
243
+ }
244
+ }
245
+
246
+ //now check where this field shows up
247
+ $rgateways = array();
248
+ foreach($pmpro_gateway_options as $gateway => $options)
249
+ {
250
+ if(in_array($field, $options))
251
+ $rgateways[] = "gateway_" . $gateway;
252
+ }
253
+
254
+ //return space separated string
255
+ return implode(" ", $rgateways);
256
}
adminpages/membershiplevels.php CHANGED
@@ -37,30 +37,30 @@
37
38
if($action == "save_membershiplevel")
39
{
40
- $ml_name = addslashes($_REQUEST['name']);
41
- $ml_description = $_REQUEST['description'];
42
- $ml_confirmation = $_REQUEST['confirmation'];
43
- $ml_initial_payment = addslashes($_REQUEST['initial_payment']);
44
if(!empty($_REQUEST['recurring']))
45
$ml_recurring = 1;
46
else
47
$ml_recurring = 0;
48
- $ml_billing_amount = addslashes($_REQUEST['billing_amount']);
49
- $ml_cycle_number = addslashes($_REQUEST['cycle_number']);
50
- $ml_cycle_period = addslashes($_REQUEST['cycle_period']);
51
- $ml_billing_limit = addslashes($_REQUEST['billing_limit']);
52
if(!empty($_REQUEST['custom_trial']))
53
$ml_custom_trial = 1;
54
else
55
$ml_custom_trial = 0;
56
- $ml_trial_amount = addslashes($_REQUEST['trial_amount']);
57
- $ml_trial_limit = addslashes($_REQUEST['trial_limit']);
58
if(!empty($_REQUEST['expiration']))
59
$ml_expiration = 1;
60
else
61
$ml_expiration = 0;
62
- $ml_expiration_number = addslashes($_REQUEST['expiration_number']);
63
- $ml_expiration_period = addslashes($_REQUEST['expiration_period']);
64
$ml_categories = array();
65
66
//reversing disable to allow here
@@ -291,7 +291,7 @@
291
292
<tr>
293
<th scope="row" valign="top"><label for="name"><?php _e('Name', 'pmpro');?>:</label></th>
294
- <td><input name="name" type="text" size="50" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->name))?>" /></td>
295
</tr>
296
297
<tr>
@@ -300,11 +300,11 @@
300
<div id="poststuff" class="pmpro_description">
301
<?php
302
if(version_compare($wp_version, "3.3") >= 0)
303
- wp_editor(stripslashes($level->description), "description", array("textarea_rows"=>5));
304
else
305
{
306
?>
307
- <textarea rows="10" cols="80" name="description" id="description"><?php echo stripslashes($level->description)?></textarea>
308
<?php
309
}
310
?>
@@ -318,11 +318,11 @@
318
<div class="pmpro_confirmation">
319
<?php
320
if(version_compare($wp_version, "3.3") >= 0)
321
- wp_editor(stripslashes($level->confirmation), "confirmation", array("textarea_rows"=>5));
322
else
323
{
324
?>
325
- <textarea rows="10" cols="80" name="confirmation" id="confirmation"><?php echo stripslashes($level->confirmation)?></textarea>
326
<?php
327
}
328
?>
@@ -342,7 +342,7 @@
342
if(pmpro_getCurrencyPosition() == "left")
343
echo $pmpro_currency_symbol;
344
?>
345
- <input name="initial_payment" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->initial_payment))?>" />
346
<?php
347
if(pmpro_getCurrencyPosition() == "right")
348
echo $pmpro_currency_symbol;
@@ -362,13 +362,13 @@
362
if(pmpro_getCurrencyPosition() == "left")
363
echo $pmpro_currency_symbol;
364
?>
365
- <input name="billing_amount" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->billing_amount))?>" />
366
<?php
367
if(pmpro_getCurrencyPosition() == "right")
368
echo $pmpro_currency_symbol;
369
?>
370
<small><?php _e('per', 'pmpro');?></small>
371
- <input id="cycle_number" name="cycle_number" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->cycle_number))?>" />
372
<select id="cycle_period" name="cycle_period">
373
<?php
374
$cycles = array( __('Day(s)', 'pmpro') => 'Day', __('Week(s)', 'pmpro') => 'Week', __('Month(s)', 'pmpro') => 'Month', __('Year(s)', 'pmpro') => 'Year' );
@@ -428,13 +428,13 @@
428
if(pmpro_getCurrencyPosition() == "left")
429
echo $pmpro_currency_symbol;
430
?>
431
- <input name="trial_amount" type="text" size="20" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_amount))?>" />
432
<?php
433
if(pmpro_getCurrencyPosition() == "right")
434
echo $pmpro_currency_symbol;
435
?>
436
<small><?php _e('for the first', 'pmpro');?></small>
437
- <input name="trial_limit" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->trial_limit))?>" />
438
<small><?php _e('subscription payments', 'pmpro');?>.</small>
439
<?php if($gateway == "stripe") { ?>
440
<br /><small>
@@ -454,6 +454,7 @@
454
455
</tbody>
456
</table>
457
<h3 class="topborder"><?php _e('Other Settings', 'pmpro');?></h3>
458
<table class="form-table">
459
<tbody>
@@ -470,7 +471,7 @@
470
<tr class="expiration_info" <?php if(!pmpro_isLevelExpiring($level)) {?>style="display: none;"<?php } ?>>
471
<th scope="row" valign="top"><label for="billing_amount"><?php _e('Expires In', 'pmpro');?>:</label></th>
472
<td>
473
- <input id="expiration_number" name="expiration_number" type="text" size="10" value="<?php echo str_replace("\"", "&quot;", stripslashes($level->expiration_number))?>" />
474
<select id="expiration_period" name="expiration_period">
475
<?php
476
$cycles = array( __('Day(s)', 'pmpro') => 'Day', __('Week(s)', 'pmpro') => 'Week', __('Month(s)', 'pmpro') => 'Month', __('Year(s)', 'pmpro') => 'Year' );
@@ -522,7 +523,7 @@
522
{
523
?>
524
525
- <h2><?php _e('Membership Levels', 'pmpro');?> <a href="admin.php?page=pmpro-membershiplevels&edit=-1" class="add-new-h2"><?php _e('Add New Level', 'pmpro');?></a></h2>
526
<form id="posts-filter" method="get" action="">
527
<p class="search-box">
528
<label class="screen-reader-text" for="post-search-input"><?php _e('Search Levels', 'pmpro');?>:</label>
@@ -539,14 +540,10 @@
539
<tr>
540
<th><?php _e('ID', 'pmpro');?></th>
541
<th><?php _e('Name', 'pmpro');?></th>
542
- <th><?php _e('Initial Payment', 'pmpro');?></th>
543
- <th><?php _e('Billing Cycle', 'pmpro');?></th>
544
- <th><?php _e('Trial Cycle', 'pmpro');?></th>
545
<th><?php _e('Expiration', 'pmpro');?></th>
546
<th><?php _e('Allow Signups', 'pmpro');?></th>
547
<th></th>
548
- <th></th>
549
- <th></th>
550
</tr>
551
</thead>
552
<tbody>
@@ -561,31 +558,14 @@
561
foreach($levels as $level)
562
{
563
?>
564
- <tr class="<?php if(!$level->allow_signups) { ?>pmpro_gray<?php } ?> <?php if(!pmpro_checkLevelForStripeCompatibility($level) || !pmpro_checkLevelForBraintreeCompatibility($level) || !pmpro_checkLevelForPayflowCompatibility($level) || !pmpro_checkLevelForTwoCheckoutCompatibility($level)) { ?>pmpro_error<?php } ?>">
565
<td><?php echo $level->id?></td>
566
- <td><?php echo $level->name?></td>
567
<td>
568
<?php if(pmpro_isLevelFree($level)) { ?>
569
<?php _e('FREE', 'pmpro');?>
570
<?php } else { ?>
571
- <?php echo pmpro_formatPrice($level->initial_payment);?>
572
- <?php } ?>
573
- </td>
574
- <td>
575
- <?php if(!pmpro_isLevelRecurring($level)) { ?>
576
- --
577
- <?php } else { ?>
578
- <?php echo pmpro_formatPrice($level->billing_amount);?> <?php _e('every', 'pmpro');?> <?php echo $level->cycle_number.' '.pmpro_translate_billing_period($level->cycle_period,$level->cycle_number)?>
579
-
580
- <?php if($level->billing_limit) { ?>(<?php _e('for', 'pmpro');?> <?php echo $level->billing_limit?> <?php echo sornot($level->cycle_period,$level->billing_limit)?>)<?php } ?>
581
-
582
- <?php } ?>
583
- </td>
584
- <td>
585
- <?php if(!pmpro_isLevelTrial($level)) { ?>
586
- --
587
- <?php } else { ?>
588
- <?php echo pmpro_formatPrice($level->trial_amount);?> <?php _e('for', 'pmpro');?> <?php echo $level->trial_limit?> <?php echo sornot("payment",$level->trial_limit)?>
589
<?php } ?>
590
</td>
591
<td>
@@ -595,10 +575,9 @@
595
<?php _e('After', 'pmpro');?> <?php echo $level->expiration_number?> <?php echo sornot($level->expiration_period,$level->expiration_number)?>
596
<?php } ?>
597
</td>
598
- <td><?php if($level->allow_signups) { ?><?php _e('Yes', 'pmpro');?><?php } else { ?><?php _e('No', 'pmpro');?><?php } ?></td>
599
- <td align="center"><a href="admin.php?page=pmpro-membershiplevels&amp;edit=<?php echo $level->id?>" class="edit"><?php _e('edit', 'pmpro');?></a></td>
600
- <td align="center"><a href="admin.php?page=pmpro-membershiplevels&amp;copy=<?php echo $level->id?>&amp;edit=-1" class="edit"><?php _e('copy', 'pmpro');?></a></td>
601
- <td align="center"><a href="javascript: askfirst('<?php printf(__("Are you sure you want to delete membership level %s? All subscriptions will be cancelled.", "pmpro"), $level->name);?>','admin.php?page=pmpro-membershiplevels&amp;action=delete_membership_level&amp;deleteid=<?php echo $level->id?>'); void(0);" class="delete"><?php _e('delete', 'pmpro');?></a></td>
602
</tr>
603
<?php
604
}
37
38
if($action == "save_membershiplevel")
39
{
40
+ $ml_name = stripslashes($_REQUEST['name']);
41
+ $ml_description = stripslashes($_REQUEST['description']);
42
+ $ml_confirmation = stripslashes($_REQUEST['confirmation']);
43
+ $ml_initial_payment = stripslashes($_REQUEST['initial_payment']);
44
if(!empty($_REQUEST['recurring']))
45
$ml_recurring = 1;
46
else
47
$ml_recurring = 0;
48
+ $ml_billing_amount = stripslashes($_REQUEST['billing_amount']);
49
+ $ml_cycle_number = stripslashes($_REQUEST['cycle_number']);
50
+ $ml_cycle_period = stripslashes($_REQUEST['cycle_period']);
51
+ $ml_billing_limit = stripslashes($_REQUEST['billing_limit']);
52
if(!empty($_REQUEST['custom_trial']))
53
$ml_custom_trial = 1;
54
else
55
$ml_custom_trial = 0;
56
+ $ml_trial_amount = stripslashes($_REQUEST['trial_amount']);
57
+ $ml_trial_limit = stripslashes($_REQUEST['trial_limit']);
58
if(!empty($_REQUEST['expiration']))
59
$ml_expiration = 1;
60
else
61
$ml_expiration = 0;
62
+ $ml_expiration_number = stripslashes($_REQUEST['expiration_number']);
63
+ $ml_expiration_period = stripslashes($_REQUEST['expiration_period']);
64
$ml_categories = array();
65
66
//reversing disable to allow here
291
292
<tr>
293
<th scope="row" valign="top"><label for="name"><?php _e('Name', 'pmpro');?>:</label></th>
294
+ <td><input name="name" type="text" size="50" value="<?php echo esc_attr($level->name);?>" /></td>
295
</tr>
296
297
<tr>
300
<div id="poststuff" class="pmpro_description">
301
<?php
302
if(version_compare($wp_version, "3.3") >= 0)
303
+ wp_editor($level->description, "description", array("textarea_rows"=>5));
304
else
305
{
306
?>
307
+ <textarea rows="10" cols="80" name="description" id="description"><?php echo esc_textarea($level->description);?></textarea>
308
<?php
309
}
310
?>
318
<div class="pmpro_confirmation">
319
<?php
320
if(version_compare($wp_version, "3.3") >= 0)
321
+ wp_editor($level->confirmation, "confirmation", array("textarea_rows"=>5));
322
else
323
{
324
?>
325
+ <textarea rows="10" cols="80" name="confirmation" id="confirmation"><?php echo esc_textarea($level->confirmation);?></textarea>
326
<?php
327
}
328
?>
342
if(pmpro_getCurrencyPosition() == "left")
343
echo $pmpro_currency_symbol;
344
?>
345
+ <input name="initial_payment" type="text" size="20" value="<?php echo esc_attr($level->initial_payment);?>" />
346
<?php
347
if(pmpro_getCurrencyPosition() == "right")
348
echo $pmpro_currency_symbol;
362
if(pmpro_getCurrencyPosition() == "left")
363
echo $pmpro_currency_symbol;
364
?>
365
+ <input name="billing_amount" type="text" size="20" value="<?php echo esc_attr($level->billing_amount);?>" />
366
<?php
367
if(pmpro_getCurrencyPosition() == "right")
368
echo $pmpro_currency_symbol;
369
?>
370
<small><?php _e('per', 'pmpro');?></small>
371
+ <input id="cycle_number" name="cycle_number" type="text" size="10" value="<?php echo esc_attr($level->cycle_number);?>" />
372
<select id="cycle_period" name="cycle_period">
373
<?php
374
$cycles = array( __('Day(s)', 'pmpro') => 'Day', __('Week(s)', 'pmpro') => 'Week', __('Month(s)', 'pmpro') => 'Month', __('Year(s)', 'pmpro') => 'Year' );
428
if(pmpro_getCurrencyPosition() == "left")
429
echo $pmpro_currency_symbol;
430
?>
431
+ <input name="trial_amount" type="text" size="20" value="<?php echo esc_attr($level->trial_amount);?>" />
432
<?php
433
if(pmpro_getCurrencyPosition() == "right")
434
echo $pmpro_currency_symbol;
435
?>
436
<small><?php _e('for the first', 'pmpro');?></small>
437
+ <input name="trial_limit" type="text" size="10" value="<?php echo esc_attr($level->trial_limit);?>" />
438
<small><?php _e('subscription payments', 'pmpro');?>.</small>
439
<?php if($gateway == "stripe") { ?>
440
<br /><small>
454
455
</tbody>
456
</table>
457
+
458
<h3 class="topborder"><?php _e('Other Settings', 'pmpro');?></h3>
459
<table class="form-table">
460
<tbody>
471
<tr class="expiration_info" <?php if(!pmpro_isLevelExpiring($level)) {?>style="display: none;"<?php } ?>>
472
<th scope="row" valign="top"><label for="billing_amount"><?php _e('Expires In', 'pmpro');?>:</label></th>
473
<td>
474
+ <input id="expiration_number" name="expiration_number" type="text" size="10" value="<?php echo esc_attr($level->expiration_number);?>" />
475
<select id="expiration_period" name="expiration_period">
476
<?php
477
$cycles = array( __('Day(s)', 'pmpro') => 'Day', __('Week(s)', 'pmpro') => 'Week', __('Month(s)', 'pmpro') => 'Month', __('Year(s)', 'pmpro') => 'Year' );
523
{
524
?>
525
526
+ <h2 class="alignleft"><?php _e('Membership Levels', 'pmpro');?> <a href="admin.php?page=pmpro-membershiplevels&edit=-1" class="add-new-h2"><?php _e('Add New Level', 'pmpro');?></a></h2>
527
<form id="posts-filter" method="get" action="">
528
<p class="search-box">
529
<label class="screen-reader-text" for="post-search-input"><?php _e('Search Levels', 'pmpro');?>:</label>
540
<tr>
541
<th><?php _e('ID', 'pmpro');?></th>
542
<th><?php _e('Name', 'pmpro');?></th>
543
+ <th><?php _e('Billing Details', 'pmpro');?></th>
544
<th><?php _e('Expiration', 'pmpro');?></th>
545
<th><?php _e('Allow Signups', 'pmpro');?></th>
546
<th></th>
547
</tr>
548
</thead>
549
<tbody>
558
foreach($levels as $level)
559
{
560
?>
561
+ <tr class="<?php if($count++ % 2 == 1) { ?>alternate<?php } ?> <?php if(!$level->allow_signups) { ?>pmpro_gray<?php } ?> <?php if(!pmpro_checkLevelForStripeCompatibility($level) || !pmpro_checkLevelForBraintreeCompatibility($level) || !pmpro_checkLevelForPayflowCompatibility($level) || !pmpro_checkLevelForTwoCheckoutCompatibility($level)) { ?>pmpro_error<?php } ?>">
562
<td><?php echo $level->id?></td>
563
+ <td class="level_name"><a href="admin.php?page=pmpro-membershiplevels&edit=<?php echo $level->id?>"><?php echo $level->name?></a></td>
564
<td>
565
<?php if(pmpro_isLevelFree($level)) { ?>
566
<?php _e('FREE', 'pmpro');?>
567
<?php } else { ?>
568
+ <?php echo str_replace( 'The price for membership is', '', pmpro_getLevelCost($level)); ?>
569
<?php } ?>
570
</td>
571
<td>
575
<?php _e('After', 'pmpro');?> <?php echo $level->expiration_number?> <?php echo sornot($level->expiration_period,$level->expiration_number)?>
576
<?php } ?>
577
</td>
578
+ <td><?php if($level->allow_signups) { ?><a href="<?php echo pmpro_url("checkout", "?level=" . $level->id);?>"><?php _e('Yes', 'pmpro');?></a><?php } else { ?><?php _e('No', 'pmpro');?><?php } ?></td>
579
+
580
+ <td><a title="<?php _e('edit','pmpro'); ?>" href="admin.php?page=pmpro-membershiplevels&edit=<?php echo $level->id?>" class="button-primary"><?php _e('edit','pmpro'); ?></a>&nbsp;<a title="<?php _e('copy','pmpro'); ?>" href="admin.php?page=pmpro-membershiplevels&copy=<?php echo $level->id?>&edit=-1" class="button-secondary"><?php _e('copy','pmpro'); ?></a>&nbsp;<a title="<?php _e('delete','pmpro'); ?>" href="javascript: askfirst('<?php printf(__("Are you sure you want to delete membership level %s? All subscriptions will be cancelled.", "pmpro"), $level->name);?>','admin.php?page=pmpro-membershiplevels&action=delete_membership_level&deleteid=<?php echo $level->id?>'); void(0);" class="button-secondary"><?php _e('delete','pmpro'); ?></a></td>
581
</tr>
582
<?php
583
}
adminpages/memberslist-csv.php CHANGED
@@ -38,66 +38,73 @@
38
{
39
$end = NULL;
40
$start = NULL;
41
- }
42
-
43
- if($s)
44
- {
45
- $sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, UNIX_TIMESTAMP(u.user_registered) as joindate, u.user_login, u.user_nicename, u.user_url, u.user_registered, u.user_status, u.display_name, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership FROM $wpdb->users u LEFT JOIN $wpdb->usermeta um ON u.ID = um.user_id LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id ";
46
-
47
- if($l == "oldmembers")
48
- $sqlQuery .= " LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON u.ID = mu2.user_id AND mu2.status = 'active' ";
49
-
50
- $sqlQuery .= " WHERE mu.membership_id > 0 AND (u.user_login LIKE '%" . esc_sql($s) . "%' OR u.user_email LIKE '%" . esc_sql($s) . "%' OR um.meta_value LIKE '%" . esc_sql($s) . "%') ";
51
-
52
- if($l == "oldmembers")
53
- $sqlQuery .= " AND mu.status = 'inactive' AND mu2.status IS NULL ";
54
- elseif($l)
55
- $sqlQuery .= " AND mu.status = 'active' AND mu.membership_id = '" . esc_sql($l) . "' ";
56
- else
57
- $sqlQuery .= " AND mu.status = 'active' ";
58
-
59
- $sqlQuery .= "GROUP BY u.ID ";
60
-
61
- if($l == "oldmembers")
62
- $sqlQuery .= "ORDER BY enddate DESC ";
63
- else
64
- $sqlQuery .= "ORDER BY u.user_registered DESC ";
65
-
66
- if($limit)
67
- $sqlQuery .= "LIMIT $start, $limit";
68
- }
69
- else
70
- {
71
- $sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, UNIX_TIMESTAMP(mu.enddate) as enddate FROM $wpdb->users u LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id ";
72
-
73
- if($l == "oldmembers")
74
- $sqlQuery .= " LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON u.ID = mu2.user_id AND mu2.status = 'active' ";
75
-
76
- $sqlQuery .= " WHERE mu.membership_id > 0 ";
77
-
78
- if($l == "oldmembers")
79
- $sqlQuery .= " AND mu.status = 'inactive' AND mu2.status IS NULL ";
80
- elseif($l)
81
- $sqlQuery .= " AND mu.status = 'active' AND mu.membership_id = '" . $l . "' ";
82
- else
83
- $sqlQuery .= " AND mu.status = 'active' ";
84
-
85
- $sqlQuery .= "GROUP BY u.ID ";
86
-
87
- if($l == "oldmembers")
88
- $sqlQuery .= "ORDER BY enddate DESC ";
89
- else
90
- $sqlQuery .= "ORDER BY u.user_registered DESC ";
91
-
92
- if($limit)
93
- $sqlQuery .= "LIMIT $start, $limit";
94
}
95
-
96
//filter
97
- $sqlQuery = apply_filters("pmpro_members_list_sql", $sqlQuery);
98
-
99
//get users
100
- $theusers = $wpdb->get_col($sqlQuery);
101
102
//begin output
103
header("Content-type: text/csv");
38
{
39
$end = NULL;
40
$start = NULL;
41
}
42
+
43
+ if($s)
44
+ {
45
+ $sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership FROM $wpdb->users u LEFT JOIN $wpdb->usermeta um ON u.ID = um.user_id LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id ";
46
+
47
+ if($l == "oldmembers" || $l == "expired" || $l == "cancelled")
48
+ $sqlQuery .= " LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON u.ID = mu2.user_id AND mu2.status = 'active' ";
49
+
50
+ $sqlQuery .= " WHERE mu.membership_id > 0 AND (u.user_login LIKE '%$s%' OR u.user_email LIKE '%$s%' OR um.meta_value LIKE '%$s%') ";
51
+
52
+ if($l == "oldmembers")
53
+ $sqlQuery .= " AND mu.status <> 'active' AND mu2.status IS NULL ";
54
+ elseif($l == "expired")
55
+ $sqlQuery .= " AND mu.status = 'expired' AND mu2.status IS NULL ";
56
+ elseif($l == "cancelled")
57
+ $sqlQuery .= " AND mu.status IN('cancelled', 'admin_cancelled') AND mu2.status IS NULL ";
58
+ elseif($l)
59
+ $sqlQuery .= " AND mu.status = 'active' AND mu.membership_id = '" . $l . "' ";
60
+ else
61
+ $sqlQuery .= " AND mu.status = 'active' ";
62
+
63
+ $sqlQuery .= "GROUP BY u.ID ";
64
+
65
+ if($l == "oldmembers" || $l == "expired" || $l == "cancelled")
66
+ $sqlQuery .= "ORDER BY enddate DESC ";
67
+ else
68
+ $sqlQuery .= "ORDER BY u.user_registered DESC ";
69
+
70
+ if(!empty($limit))
71
+ $sqlQuery .= "LIMIT $start, $limit";
72
+ }
73
+ else
74
+ {
75
+ $sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership FROM $wpdb->users u LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id";
76
+
77
+ if($l == "oldmembers" || $l == "expired" || $l == "cancelled")
78
+ $sqlQuery .= " LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON u.ID = mu2.user_id AND mu2.status = 'active' ";
79
+
80
+ $sqlQuery .= " WHERE mu.membership_id > 0 ";
81
+
82
+ if($l == "oldmembers")
83
+ $sqlQuery .= " AND mu.status <> 'active' AND mu2.status IS NULL ";
84
+ elseif($l == "expired")
85
+ $sqlQuery .= " AND mu.status = 'expired' AND mu2.status IS NULL ";
86
+ elseif($l == "cancelled")
87
+ $sqlQuery .= " AND mu.status IN('cancelled', 'admin_cancelled') AND mu2.status IS NULL ";
88
+ elseif($l)
89
+ $sqlQuery .= " AND mu.status = 'active' AND mu.membership_id = '" . $l . "' ";
90
+ else
91
+ $sqlQuery .= " AND mu.status = 'active' ";
92
+ $sqlQuery .= "GROUP BY u.ID ";
93
+
94
+ if($l == "oldmembers" || $l == "expired" || $l == "cancelled")
95
+ $sqlQuery .= "ORDER BY enddate DESC ";
96
+ else
97
+ $sqlQuery .= "ORDER BY u.user_registered DESC ";
98
+
99
+ if(!empty($limit))
100
+ $sqlQuery .= "LIMIT $start, $limit";
101
+ }
102
+
103
//filter
104
+ $sqlQuery = apply_filters("pmpro_members_list_sql", $sqlQuery);
105
+
106
//get users
107
+ $theusers = $wpdb->get_col($sqlQuery);
108
109
//begin output
110
header("Content-type: text/csv");
adminpages/memberslist.php CHANGED
@@ -39,7 +39,9 @@
39
<?php
40
}
41
?>
42
- <option value="oldmembers" <?php if($l == "oldmembers") { ?>selected="selected"<?php } ?>><?php _e('Old Members', 'pmpro');?></option>
43
</select>
44
</li>
45
</ul>
@@ -68,13 +70,17 @@
68
{
69
$sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership FROM $wpdb->users u LEFT JOIN $wpdb->usermeta um ON u.ID = um.user_id LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id ";
70
71
- if($l == "oldmembers")
72
$sqlQuery .= " LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON u.ID = mu2.user_id AND mu2.status = 'active' ";
73
74
$sqlQuery .= " WHERE mu.membership_id > 0 AND (u.user_login LIKE '%$s%' OR u.user_email LIKE '%$s%' OR um.meta_value LIKE '%$s%') ";
75
76
if($l == "oldmembers")
77
- $sqlQuery .= " AND mu.status = 'inactive' AND mu2.status IS NULL ";
78
elseif($l)
79
$sqlQuery .= " AND mu.status = 'active' AND mu.membership_id = '" . $l . "' ";
80
else
@@ -82,7 +88,7 @@
82
83
$sqlQuery .= "GROUP BY u.ID ";
84
85
- if($l == "oldmembers")
86
$sqlQuery .= "ORDER BY enddate DESC ";
87
else
88
$sqlQuery .= "ORDER BY u.user_registered DESC ";
@@ -93,27 +99,31 @@
93
{
94
$sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership FROM $wpdb->users u LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id";
95
96
- if($l == "oldmembers")
97
$sqlQuery .= " LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON u.ID = mu2.user_id AND mu2.status = 'active' ";
98
99
$sqlQuery .= " WHERE mu.membership_id > 0 ";
100
101
if($l == "oldmembers")
102
- $sqlQuery .= " AND mu.status = 'inactive' AND mu2.status IS NULL ";
103
elseif($l)
104
$sqlQuery .= " AND mu.status = 'active' AND mu.membership_id = '" . $l . "' ";
105
else
106
$sqlQuery .= " AND mu.status = 'active' ";
107
$sqlQuery .= "GROUP BY u.ID ";
108
109
- if($l == "oldmembers")
110
$sqlQuery .= "ORDER BY enddate DESC ";
111
else
112
$sqlQuery .= "ORDER BY u.user_registered DESC ";
113
114
$sqlQuery .= "LIMIT $start, $limit";
115
}
116
-
117
$sqlQuery = apply_filters("pmpro_members_list_sql", $sqlQuery);
118
119
$theusers = $wpdb->get_results($sqlQuery);
@@ -171,7 +181,7 @@
171
?>
172
<tr <?php if($count++ % 2 == 0) { ?>class="alternate"<?php } ?>>
173
<td><?php echo $theuser->ID?></td>
174
- <td>
175
<?php echo get_avatar($theuser->ID, 32)?>
176
<strong>
177
<?php
@@ -180,6 +190,24 @@
180
echo $userlink;
181
?>
182
</strong>
183
</td>
184
<td><?php echo $theuser->first_name?></td>
185
<td><?php echo $theuser->last_name?></td>
39
<?php
40
}
41
?>
42
+ <option value="cancelled" <?php if($l == "cancelled") { ?>selected="selected"<?php } ?>><?php _e('Cancelled Members', 'pmpro');?></option>
43
+ <option value="expired" <?php if($l == "expired") { ?>selected="selected"<?php } ?>><?php _e('Expired Members', 'pmpro');?></option>
44
+ <option value="oldmembers" <?php if($l == "oldmembers") { ?>selected="selected"<?php } ?>><?php _e('Old Members', 'pmpro');?></option>
45
</select>
46
</li>
47
</ul>
70
{
71
$sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership FROM $wpdb->users u LEFT JOIN $wpdb->usermeta um ON u.ID = um.user_id LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id ";
72
73
+ if($l == "oldmembers" || $l == "expired" || $l == "cancelled")
74
$sqlQuery .= " LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON u.ID = mu2.user_id AND mu2.status = 'active' ";
75
76
$sqlQuery .= " WHERE mu.membership_id > 0 AND (u.user_login LIKE '%$s%' OR u.user_email LIKE '%$s%' OR um.meta_value LIKE '%$s%') ";
77
78
if($l == "oldmembers")
79
+ $sqlQuery .= " AND mu.status <> 'active' AND mu2.status IS NULL ";
80
+ elseif($l == "expired")
81
+ $sqlQuery .= " AND mu.status = 'expired' AND mu2.status IS NULL ";
82
+ elseif($l == "cancelled")
83
+ $sqlQuery .= " AND mu.status IN('cancelled', 'admin_cancelled') AND mu2.status IS NULL ";
84
elseif($l)
85
$sqlQuery .= " AND mu.status = 'active' AND mu.membership_id = '" . $l . "' ";
86
else
88
89
$sqlQuery .= "GROUP BY u.ID ";
90
91
+ if($l == "oldmembers" || $l == "expired" || $l == "cancelled")
92
$sqlQuery .= "ORDER BY enddate DESC ";
93
else
94
$sqlQuery .= "ORDER BY u.user_registered DESC ";
99
{
100
$sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership FROM $wpdb->users u LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id";
101
102
+ if($l == "oldmembers" || $l == "expired" || $l == "cancelled")
103
$sqlQuery .= " LEFT JOIN $wpdb->pmpro_memberships_users mu2 ON u.ID = mu2.user_id AND mu2.status = 'active' ";
104
105
$sqlQuery .= " WHERE mu.membership_id > 0 ";
106
107
if($l == "oldmembers")
108
+ $sqlQuery .= " AND mu.status <> 'active' AND mu2.status IS NULL ";
109
+ elseif($l == "expired")
110
+ $sqlQuery .= " AND mu.status = 'expired' AND mu2.status IS NULL ";
111
+ elseif($l == "cancelled")
112
+ $sqlQuery .= " AND mu.status IN('cancelled', 'admin_cancelled') AND mu2.status IS NULL ";
113
elseif($l)
114
$sqlQuery .= " AND mu.status = 'active' AND mu.membership_id = '" . $l . "' ";
115
else
116
$sqlQuery .= " AND mu.status = 'active' ";
117
$sqlQuery .= "GROUP BY u.ID ";
118
119
+ if($l == "oldmembers" || $l == "expired" || $l == "cancelled")
120
$sqlQuery .= "ORDER BY enddate DESC ";
121
else
122
$sqlQuery .= "ORDER BY u.user_registered DESC ";
123
124
$sqlQuery .= "LIMIT $start, $limit";
125
}
126
+
127
$sqlQuery = apply_filters("pmpro_members_list_sql", $sqlQuery);
128
129
$theusers = $wpdb->get_results($sqlQuery);
181
?>
182
<tr <?php if($count++ % 2 == 0) { ?>class="alternate"<?php } ?>>
183
<td><?php echo $theuser->ID?></td>
184
+ <td class="username column-username">
185
<?php echo get_avatar($theuser->ID, 32)?>
186
<strong>
187
<?php
190
echo $userlink;
191
?>
192
</strong>
193
+ <br />
194
+ <?php
195
+ // Set up the hover actions for this user
196
+ $actions = apply_filters( 'pmpro_memberslist_user_row_actions', array(), $theuser );
197
+ $action_count = count( $actions );
198
+ $i = 0;
199
+ if($action_count)
200
+ {
201
+ $out = '<div class="row-actions">';
202
+ foreach ( $actions as $action => $link ) {
203
+ ++$i;
204
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
205
+ $out .= "<span class='$action'>$link$sep</span>";
206
+ }
207
+ $out .= '</div>';
208
+ echo $out;
209
+ }
210
+ ?>
211
</td>
212
<td><?php echo $theuser->first_name?></td>
213
<td><?php echo $theuser->last_name?></td>
adminpages/orders.php CHANGED
@@ -3,61 +3,61 @@
3
if(!function_exists("current_user_can") || (!current_user_can("manage_options") && !current_user_can("pmpro_orders")))
4
{
5
die(__("You do not have permissions to perform this action.", "pmpro"));
6
- }
7
-
8
//vars
9
global $wpdb;
10
if(isset($_REQUEST['s']))
11
$s = $_REQUEST['s'];
12
else
13
$s = "";
14
-
15
if(isset($_REQUEST['l']))
16
$l = $_REQUEST['l'];
17
else
18
$l = false;
19
-
20
if(isset($_REQUEST['start-month']))
21
$start_month = $_REQUEST['start-month'];
22
else
23
$start_month = "1";
24
-
25
if(isset($_REQUEST['start-day']))
26
$start_day = $_REQUEST['start-day'];
27
else
28
$start_day = "1";
29
-
30
if(isset($_REQUEST['start-year']))
31
$start_year = $_REQUEST['start-year'];
32
else
33
$start_year = date("Y");
34
-
35
if(isset($_REQUEST['end-month']))
36
$end_month = $_REQUEST['end-month'];
37
else
38
$end_month = date("n");
39
-
40
if(isset($_REQUEST['end-day']))
41
$end_day = $_REQUEST['end-day'];
42
else
43
$end_day = date("j");
44
-
45
if(isset($_REQUEST['end-year']))
46
$end_year = $_REQUEST['end-year'];
47
else
48
- $end_year = date("Y");
49
-
50
if(isset($_REQUEST['predefined-date']))
51
$predefined_date = $_REQUEST['predefined-date'];
52
else
53
- $predefined_date = "This Month";
54
-
55
if(isset($_REQUEST['status']))
56
$status = $_REQUEST['status'];
57
else
58
$status = "";
59
-
60
-
61
//deleting?
62
if(!empty($_REQUEST['delete']))
63
{
@@ -73,19 +73,19 @@
73
$pmpro_msgt = "error";
74
}
75
}
76
-
77
if(isset($_REQUEST['filter']))
78
$filter = sanitize_text_field($_REQUEST['filter']);
79
else
80
$filter = "all";
81
-
82
$thisyear = date("Y");
83
-
84
-
85
-
86
//this array stores fields that should be read only
87
$read_only_fields = apply_filters("pmpro_orders_read_only_fields", array("code", "payment_transaction_id", "subscription_transaction_id"));
88
-
89
//saving?
90
if(!empty($_REQUEST['save']))
91
{
@@ -95,7 +95,7 @@
95
$order = new MemberOrder($order_id);
96
else
97
$order = new MemberOrder();
98
-
99
//update values
100
if(!in_array("code", $read_only_fields))
101
$order->code = $_POST['code'];
@@ -105,7 +105,7 @@
105
$order->membership_id = intval($_POST['membership_id']);
106
if(!in_array("billing_name", $read_only_fields))
107
$order->billing->name = stripslashes($_POST['billing_name']);
108
- if(!in_array("billing_street", $read_only_fields))
109
$order->billing->street = stripslashes($_POST['billing_street']);
110
if(!in_array("billing_city", $read_only_fields))
111
$order->billing->city = stripslashes($_POST['billing_city']);
@@ -132,7 +132,7 @@
132
if(!in_array("accountnumber", $read_only_fields))
133
$order->accountnumber = $_POST['accountnumber'];
134
if(!in_array("expirationmonth", $read_only_fields))
135
- $order->expirationmonth = $_POST['expirationmonth'];
136
if(!in_array("expirationyear", $read_only_fields))
137
$order->expirationyear = $_POST['expirationyear'];
138
if(!in_array("ExpirationDate", $read_only_fields))
@@ -149,7 +149,7 @@
149
$order->subscription_transaction_id = $_POST['subscription_transaction_id'];
150
if(!in_array("notes", $read_only_fields))
151
$order->notes = stripslashes($_POST['notes']);
152
-
153
//affiliate stuff
154
$affiliates = apply_filters("pmpro_orders_show_affiliate_ids", false);
155
if(!empty($affiliates))
@@ -159,10 +159,10 @@
159
if(!in_array("affiliate_subid", $read_only_fields))
160
$order->affiliate_subid = $_POST['affiliate_subid'];
161
}
162
-
163
//save
164
if($order->saveOrder() !== false)
165
- {
166
//handle timestamp
167
if($order->updateTimestamp($_POST['ts_year'], $_POST['ts_month'], $_POST['ts_day']) !== false)
168
{
@@ -174,7 +174,7 @@
174
$pmpro_msg = __("Error updating order timestamp.", "pmpro");
175
$pmpro_msgt = "error";
176
}
177
- }
178
else
179
{
180
$pmpro_msg = __("Error saving order.", "pmpro");
@@ -182,7 +182,7 @@
182
}
183
}
184
else
185
- {
186
//order passed?
187
if(!empty($_REQUEST['order']))
188
{
@@ -192,17 +192,17 @@
192
elseif(!empty($_REQUEST['copy']))
193
{
194
$order = new MemberOrder(intval($_REQUEST['copy']));
195
-
196
//new id
197
$order->id = NULL;
198
-
199
//new code
200
$order->code = $order->getRandomCode();
201
}
202
else
203
{
204
$order = new MemberOrder(); //new order
205
-
206
//defaults
207
$order->code = $order->getRandomCode();
208
$order->user_id = "";
@@ -222,7 +222,7 @@
222
$order->cardtype = "";
223
$order->accountnumber = "";
224
$order->expirationmonth = "";
225
- $order->expirationyear = "";
226
$order->status = "success";
227
$order->gateway = pmpro_getOption("gateway");
228
$order->gateway_environment = pmpro_getOption("gateway_environment");
@@ -234,8 +234,8 @@
234
}
235
}
236
}
237
-
238
- require_once(dirname(__FILE__) . "/admin_header.php");
239
?>
240
241
<?php if(!empty($order)) { ?>
@@ -247,20 +247,20 @@
247
<?php _e('New Order', 'pmpro');?>
248
<?php } ?>
249
</h2>
250
-
251
<?php if(!empty($pmpro_msg)) { ?>
252
<div id="message" class="<?php if($pmpro_msgt == "success") echo "updated fade"; else echo "error"; ?>"><p><?php echo $pmpro_msg?></p></div>
253
<?php } ?>
254
-
255
<form method="post" action="">
256
-
257
<table class="form-table">
258
<tbody>
259
<tr>
260
<th scope="row" valign="top"><label>ID:</label></th>
261
<td><?php if(!empty($order->id)) echo $order->id; else echo __("This will be generated when you save.", "pmpro");?></td>
262
- </tr>
263
-
264
<tr>
265
<th scope="row" valign="top"><label for="code"><?php _e('Code', 'pmpro');?>:</label></th>
266
<td>
@@ -270,7 +270,7 @@
270
<?php if($order_id < 0) { ?><small class="pmpro_lite"><?php _e('Randomly generated for you.', 'pmpro');?></small><?php } ?>
271
</td>
272
</tr>
273
-
274
<tr>
275
<th scope="row" valign="top"><label for="user_id"><?php _e('User ID', 'pmpro');?>:</label></th>
276
<td>
@@ -279,7 +279,7 @@
279
<?php } ?>
280
</td>
281
</tr>
282
-
283
<tr>
284
<th scope="row" valign="top"><label for="membership_id"><?php _e('Membership Level ID', 'pmpro');?>:</label></th>
285
<td>
@@ -288,7 +288,7 @@
288
<?php } ?>
289
</td>
290
</tr>
291
-
292
<tr>
293
<th scope="row" valign="top"><label for="billing_name"><?php _e('Billing Name', 'pmpro');?>:</label></th>
294
<td>
@@ -296,7 +296,7 @@
296
<input id="billing_name" name="billing_name" type="text" size="50" value="<?php echo esc_attr($order->billing->name);?>" />
297
<?php } ?>
298
</td>
299
- </tr>
300
<tr>
301
<th scope="row" valign="top"><label for="billing_street"><?php _e('Billing Street', 'pmpro');?>:</label></th>
302
<td>
@@ -341,12 +341,12 @@
341
<?php } ?>
342
</td>
343
</tr>
344
-
345
<tr>
346
<th scope="row" valign="top"><label for="subtotal"><?php _e('Sub Total', 'pmpro');?>:</label></th>
347
<td>
348
<?php if(in_array("subtotal", $read_only_fields) && $order_id > 0) { echo $order->subtotal; } else { ?>
349
- <input id="subtotal" name="subtotal" type="text" size="10" value="<?php echo esc_attr($order->subtotal);?>" />
350
<?php } ?>
351
</td>
352
</tr>
@@ -354,7 +354,7 @@
354
<th scope="row" valign="top"><label for="tax"><?php _e('Tax', 'pmpro');?>:</label></th>
355
<td>
356
<?php if(in_array("tax", $read_only_fields) && $order_id > 0) { echo $order->tax; } else { ?>
357
- <input id="tax" name="tax" type="text" size="10" value="<?php echo esc_attr($order->tax);?>" />
358
<?php } ?>
359
</td>
360
</tr>
@@ -369,20 +369,20 @@
369
<tr>
370
<th scope="row" valign="top"><label for="total"><?php _e('Total', 'pmpro');?>:</label></th>
371
<td>
372
- <?php if(in_array("total", $read_only_fields) && $order_id > 0) { echo $order->total; } else { ?>
373
<input id="total" name="total" type="text" size="10" value="<?php echo esc_attr($order->total);?>" />
374
<?php } ?>
375
- <small class="pmpro_lite"><?php _e('Should be subtotal + tax - couponamount.', 'pmpro');?></small>
376
</td>
377
</tr>
378
-
379
<tr>
380
<th scope="row" valign="top"><label for="payment_type"><?php _e('Payment Type', 'pmpro');?>:</label></th>
381
<td>
382
<?php if(in_array("payment_type", $read_only_fields) && $order_id > 0) { echo $order->payment_type; } else { ?>
383
<input id="payment_type" name="payment_type" type="text" size="50" value="<?php echo esc_attr($order->payment_type);?>" />
384
<?php } ?>
385
- <small class="pmpro_lite"><?php _e('e.g. PayPal Express, PayPal Standard, Credit Card.', 'pmpro');?></small>
386
</td>
387
</tr>
388
<tr>
@@ -418,7 +418,7 @@
418
<small class="pmpro_lite">YYYY</small>
419
</td>
420
</tr>
421
- <?php } ?>
422
<tr>
423
<th scope="row" valign="top"><label for="status"><?php _e('Status', 'pmpro');?>:</label></th>
424
<td>
@@ -429,31 +429,32 @@
429
$used_statuses = $wpdb->get_col("SELECT DISTINCT(status) FROM $wpdb->pmpro_membership_orders");
430
$statuses = array_unique(array_merge($default_statuses, $used_statuses));
431
asort($statuses);
432
- $statuses = apply_filters("pmpro_order_statuses", $statuses);
433
?>
434
<select id="status" name="status">
435
<?php foreach($statuses as $status) { ?>
436
<option value="<?php echo esc_attr($status);?>" <?php selected($order->status, $status);?>><?php echo $status;?></option>
437
<?php } ?>
438
- </select>
439
<?php } ?>
440
</td>
441
</tr>
442
-
443
<tr>
444
<th scope="row" valign="top"><label for="gateway"><?php _e('Gateway', 'pmpro');?>:</label></th>
445
<td>
446
<?php if(in_array("gateway", $read_only_fields) && $order_id > 0) { echo $order->gateway; } else { ?>
447
<select id="gateway" name="gateway" onchange="pmpro_changeGateway(jQuery(this).val());">
448
- <option value="" <?php if(empty($order->gateway)) { ?>selected="selected"<?php } ?>><?php _e('Testing Only', 'pmpro');?></option>
449
- <option value="check" <?php if($order->gateway == "check") { ?>selected="selected"<?php } ?>><?php _e('Pay by Check', 'pmpro');?></option>
450
- <option value="stripe" <?php if($order->gateway == "stripe") { ?>selected="selected"<?php } ?>>Stripe</option>
451
- <option value="paypalstandard" <?php if($order->gateway == "paypalstandard") { ?>selected="selected"<?php } ?>>PayPal Standard</option>
452
- <option value="paypalexpress" <?php if($order->gateway == "paypalexpress") { ?>selected="selected"<?php } ?>>PayPal Express</option>
453
- <option value="paypal" <?php if($order->gateway == "paypal") { ?>selected="selected"<?php } ?>>PayPal Website Payments Pro</option>
454
- <option value="payflowpro" <?php if($order->gateway == "payflowpro") { ?>selected="selected"<?php } ?>>PayPal Payflow Pro</option>
455
- <option value="authorizenet" <?php if($order->gateway == "authorizenet") { ?>selected="selected"<?php } ?>>Authorize.net</option>
456
- </select>
457
<?php } ?>
458
</td>
459
</tr>
@@ -468,7 +469,7 @@
468
<?php } ?>
469
</td>
470
</tr>
471
-
472
<tr>
473
<th scope="row" valign="top"><label for="payment_transaction_id"><?php _e('Payment Transaction ID', 'pmpro');?>:</label></th>
474
<td>
@@ -487,7 +488,7 @@
487
<small class="pmpro_lite"><?php _e('Generated by the gateway. Useful to cross reference subscriptions.', 'pmpro');?></small>
488
</td>
489
</tr>
490
-
491
<tr>
492
<th scope="row" valign="top"><label for="ts_month"><?php _e('Date', 'pmpro');?>:</label></th>
493
<td>
@@ -498,13 +499,12 @@
498
$timestamp = $order->timestamp;
499
else
500
$timestamp = current_time('timestamp');
501
-
502
$year = date("Y", $timestamp);
503
$month = date("n", $timestamp);
504
$day = date("j", $timestamp);
505
?>
506
<select id="ts_month" name="ts_month">
507
- <?php
508
for($i = 1; $i < 13; $i++)
509
{
510
?>
@@ -518,10 +518,10 @@
518
<?php } ?>
519
</td>
520
</tr>
521
-
522
- <?php
523
$affiliates = apply_filters("pmpro_orders_show_affiliate_ids", false);
524
- if(!empty($affiliates)) {
525
?>
526
<tr>
527
<th scope="row" valign="top"><label for="affiliate_id"><?php _e('Affiliate ID', 'pmpro');?>Affiliate ID:</label></th>
@@ -529,7 +529,7 @@
529
<?php if(in_array("affiliate_id", $read_only_fields) && $order_id > 0) { echo $order->affiliate_id; } else { ?>
530
<input id="affiliate_id" name="affiliate_id" type="text" size="50" value="<?php echo esc_attr($order->affiliate_id);?>" />
531
<?php } ?>
532
- </td>
533
</tr>
534
<tr>
535
<th scope="row" valign="top"><label for="affiliate_subid"><?php _e('Affiliate SubID', 'pmpro');?>Affiliate SubID:</label></th>
@@ -540,7 +540,7 @@
540
</td>
541
</tr>
542
<?php } ?>
543
-
544
<tr>
545
<th scope="row" valign="top"><label for="notes"><?php _e('Notes', 'pmpro');?>:</label></th>
546
<td>
@@ -549,27 +549,27 @@
549
<?php } ?>
550
</td>
551
</tr>
552
-
553
- <?php do_action("pmpro_after_order_settings", $order); ?>
554
-
555
</tbody>
556
</table>
557
-
558
<p class="submit topborder">
559
<input name="order" type="hidden" value="<?php if(!empty($order->id)) echo $order->id; else echo $order_id;?>" />
560
- <input name="save" type="submit" class="button-primary" value="<?php _e('Save Order', 'pmpro');?>" />
561
- <input name="cancel" type="button" class="cancel button-secondary" value="<?php _e('Cancel', 'pmpro');?>" onclick="location.href='<?php echo get_admin_url(NULL, '/admin.php?page=pmpro-orders')?>';" />
562
</p>
563
-
564
</form>
565
566
<?php } else { ?>
567
-
568
- <form id="posts-filter" method="get" action="">
569
<h2>
570
<?php _e('Orders', 'pmpro');?>
571
<a href="admin.php?page=pmpro-orders&order=-1" class="add-new-h2">+ <?php _e('Add New Order', 'pmpro');?></a>
572
-
573
<?php
574
//build the export URL
575
$export_url = admin_url('admin-ajax.php') . "?action=orders_csv";
@@ -584,22 +584,22 @@
584
"end-day"=>$end_day,
585
"end-year"=>$end_year,
586
"predefined-date"=>$predefined_date,
587
- "status"=>$status
588
- );
589
$export_url = add_query_arg($url_params, $export_url);
590
- ?>
591
<a target="_blank" href="<?php echo $export_url;?>" class="add-new-h2"><?php _e('Export to CSV', 'pmpro');?></a>
592
</h2>
593
-
594
-
595
596
<?php if(!empty($pmpro_msg)) { ?>
597
<div id="message" class="<?php if($pmpro_msgt == "success") echo "updated fade"; else echo "error"; ?>"><p><?php echo $pmpro_msg?></p></div>
598
<?php } ?>
599
-
600
-
601
<ul class="subsubsub">
602
- <li>
603
<?php _ex('Show', 'Dropdown label, e.g. Show Daily Orders for January', 'pmpro')?>
604
<select id="filter" name="filter">
605
<option value="all" <?php selected($filter, "all");?>><?php _e('All', 'pmpro');?></option>
@@ -608,15 +608,15 @@
608
<option value="within-a-level" <?php selected($filter, "within-a-level");?>><?php _e('Within a Level', 'pmpro');?></option>
609
<option value="within-a-status" <?php selected($filter, "within-a-status");?>><?php _e('Within a Status', 'pmpro');?></option>
610
</select>
611
-
612
<span id="from"><?php _ex('From', 'Dropdown label', 'pmpro')?></span>
613
-
614
<select id="start-month" name="start-month">
615
<?php for($i = 1; $i < 13; $i++) { ?>
616
<option value="<?php echo $i;?>" <?php selected($start_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i, 2));?></option>
617
<?php } ?>
618
</select>
619
-
620
<input id='start-day' name="start-day" type="text" size="2" value="<?php echo $start_day?>" />
621
<input id='start-year' name="start-year" type="text" size="4" value="<?php echo $start_year?>" />
622
@@ -628,53 +628,53 @@
628
<option value="<?php echo $i;?>" <?php selected($end_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i,2));?></option>
629
<?php } ?>
630
</select>
631
-
632
633
<input id='end-day' name="end-day" type="text" size="2" value="<?php echo $end_day?>" />
634
<input id='end-year' name="end-year" type="text" size="4" value="<?php echo $end_year?>" />
635
-
636
<span id="filterby"><?php _ex('filter by ', 'Dropdown label', 'pmpro')?></span>
637
-
638
<select id="predefined-date" name="predefined-date">
639
-
640
<option value="<?php echo "This Month";?>" <?php selected($predefined_date, "This Month");?>><?php echo "This Month";?></option>
641
<option value="<?php echo "Last Month";?>" <?php selected($predefined_date, "Last Month");?>><?php echo "Last Month";?></option>
642
<option value="<?php echo "This Year";?>" <?php selected($predefined_date, "This Year");?>><?php echo "This Year";?></option>
643
<option value="<?php echo "Last Year";?>" <?php selected($predefined_date, "Last Year");?>><?php echo "Last Year";?></option>
644
-
645
</select>
646
647
<?php
648
//Note: only orders belonging to current levels can be filtered. There is no option for orders belonging to deleted levels
649
- $levels = pmpro_getAllLevels();
650
-
651
?>
652
<select id="l" name="l">
653
<?php foreach($levels as $level) { ?>
654
- <option value="<?php echo $level->id;?>" <?php selected($l, $level->id);?>><?php echo $level->name;?></option>
655
<?php } ?>
656
-
657
</select>
658
-
659
<?php
660
$statuses = array();
661
$default_statuses = array("", "success", "cancelled", "review", "token", "refunded");
662
$used_statuses = $wpdb->get_col("SELECT DISTINCT(status) FROM $wpdb->pmpro_membership_orders");
663
$statuses = array_unique(array_merge($default_statuses, $used_statuses));
664
asort($statuses);
665
- $statuses = apply_filters("pmpro_order_statuses", $statuses);
666
?>
667
<select id="status" name="status">
668
<?php foreach($statuses as $the_status) { ?>
669
<option value="<?php echo esc_attr($the_status);?>" <?php selected($the_status, $status);?>><?php echo $the_status;?></option>
670
<?php } ?>
671
- </select>
672
-
673
-
674
<input id="submit" type="submit" value="<?php _ex('Filter', 'Submit button value.', 'pmpro');?>" />
675
</li>
676
</ul>
677
-
678
<script>
679
//update month/year when period dropdown is changed
680
jQuery(document).ready(function() {
@@ -682,7 +682,7 @@
682
pmpro_ShowMonthOrYear();
683
});
684
});
685
-
686
function pmpro_ShowMonthOrYear()
687
{
688
var filter = jQuery('#filter').val();
@@ -767,50 +767,50 @@
767
jQuery('#filterby').show();
768
}
769
}
770
-
771
pmpro_ShowMonthOrYear();
772
-
773
-
774
</script>
775
-
776
<p class="search-box">
777
<label class="hidden" for="post-search-input"><?php _e('Search Orders', 'pmpro');?>:</label>
778
- <input type="hidden" name="page" value="pmpro-orders" />
779
<input id="post-search-input" type="text" value="<?php echo $s?>" name="s"/>
780
<input class="button" type="submit" value="<?php _e('Search Orders', 'pmpro');?>"/>
781
</p>
782
783
- <?php
784
//some vars for the search
785
if(isset($_REQUEST['pn']))
786
$pn = $_REQUEST['pn'];
787
else
788
$pn = 1;
789
-
790
if(isset($_REQUEST['limit']))
791
$limit = $_REQUEST['limit'];
792
else
793
$limit = 15;
794
-
795
$end = $pn * $limit;
796
- $start = $end - $limit;
797
-
798
//filters
799
if($filter == "all" || !$filter)
800
$condition = "1=1";
801
elseif($filter == "within-a-date-range")
802
- {
803
$start_date = $start_year."-".$start_month."-".$start_day;
804
$end_date = $end_year."-".$end_month."-".$end_day;
805
-
806
//add times to dates
807
$start_date = $start_date . " 00:00:00";
808
$end_date = $end_date . " 23:59:59";
809
-
810
$condition = "timestamp BETWEEN '".$start_date."' AND '".$end_date."'";
811
}
812
elseif($filter == "predefined-date-range")
813
- {
814
if($predefined_date == "Last Month")
815
{
816
$start_date = date("Y-m-d", strtotime("first day of last month", current_time("timestamp")));
@@ -827,72 +827,72 @@
827
$start_date = date("Y-m-d", strtotime("first day of January $year", current_time("timestamp")));
828
$end_date = date("Y-m-d", strtotime("last day of December $year", current_time("timestamp")));
829
}
830
-
831
elseif($predefined_date == "Last Year")
832
{
833
$year = date('Y') - 1;
834
$start_date = date("Y-m-d", strtotime("first day of January $year", current_time("timestamp")));
835
$end_date = date("Y-m-d", strtotime("last day of December $year", current_time("timestamp")));
836
}
837
-
838
//add times to dates
839
$start_date = $start_date . " 00:00:00";
840
$end_date = $end_date . " 23:59:59";
841
-
842
$condition = "timestamp BETWEEN '".$start_date."' AND '".$end_date."'";
843
- }
844
elseif($filter == "within-a-level")
845
{
846
$condition = "membership_id = $l";
847
- }
848
elseif($filter == "within-a-status")
849
{
850
$condition = "status = '$status' ";
851
- }
852
-
853
//string search
854
if($s)
855
{
856
$sqlQuery = "SELECT SQL_CALC_FOUND_ROWS o.id FROM $wpdb->pmpro_membership_orders o LEFT JOIN $wpdb->users u ON o.user_id = u.ID LEFT JOIN $wpdb->pmpro_membership_levels l ON o.membership_id = l.id ";
857
-
858
$join_with_usermeta = apply_filters("pmpro_orders_search_usermeta", false);
859
if($join_with_usermeta)
860
$sqlQuery .= "LEFT JOIN $wpdb->usermeta um ON o.user_id = um.user_id ";
861
-
862
$sqlQuery .= "WHERE (1=2 ";
863
-
864
$fields = array("o.id", "o.code", "o.billing_name", "o.billing_street", "o.billing_city", "o.billing_state", "o.billing_zip", "o.billing_phone", "o.payment_type", "o.cardtype", "o.accountnumber", "o.status", "o.gateway", "o.gateway_environment", "o.payment_transaction_id", "o.subscription_transaction_id", "u.user_login", "u.user_email", "u.display_name", "l.name");
865
-
866
if($join_with_usermeta)
867
$fields[] = "um.meta_value";
868
-
869
$fields = apply_filters("pmpro_orders_search_fields", $fields);
870
-
871
foreach($fields as $field)
872
$sqlQuery .= " OR " . $field . " LIKE '%" . esc_sql($s) . "%' ";
873
$sqlQuery .= ") ";
874
-
875
$sqlQuery .= "AND " . $condition . " ";
876
-
877
$sqlQuery .= "GROUP BY o.id ORDER BY o.id DESC, o.timestamp DESC ";
878
}
879
else
880
{
881
$sqlQuery = "SELECT SQL_CALC_FOUND_ROWS id FROM $wpdb->pmpro_membership_orders WHERE ".$condition." ORDER BY id DESC, timestamp DESC ";
882
}
883
-
884
$sqlQuery .= "LIMIT $start, $limit";
885
-
886
$order_ids = $wpdb->get_col($sqlQuery);
887
-
888
$totalrows = $wpdb->get_var("SELECT FOUND_ROWS() as found_rows");
889
-
890
if($order_ids)
891
- {
892
?>
893
<p class="clear"><?php printf(__("%d orders found.", "pmpro"), $totalrows);?></span></p>
894
<?php
895
- }
896
?>
897
<table class="widefat">
898
<thead>
@@ -905,19 +905,19 @@
905
<th><?php _e('Total', 'pmpro');?></th>
906
<th><?php _e('Payment', 'pmpro');?></th>
907
<th><?php _e('Gateway', 'pmpro');?></th>
908
- <th><?php _e('Transaction IDs', 'pmpro');?></th>
909
<th><?php _e('Status', 'pmpro');?></th>
910
- <th><?php _e('Date', 'pmpro');?></th>
911
<th></th>
912
<th></th>
913
<th></th>
914
</tr>
915
</thead>
916
- <tbody id="orders" class="list:order orders-list">
917
- <?php
918
- $count = 0;
919
foreach($order_ids as $order_id)
920
- {
921
$order = new MemberOrder();
922
$order->nogateway = true;
923
$order->getMemberOrderByID($order_id);
@@ -925,14 +925,32 @@
925
<tr <?php if($count++ % 2 == 0) { ?>class="alternate"<?php } ?>>
926
<td><a href="admin.php?page=pmpro-orders&order=<?php echo $order->id?>"><?php echo $order->id;?></a></td>
927
<td><a href="admin.php?page=pmpro-orders&order=<?php echo $order->id?>"><?php echo $order->code;?></a></td>
928
- <td>
929
- <?php $order->getUser(); ?>
930
<?php if(!empty($order->user)) { ?>
931
<a href="user-edit.php?user_id=<?php echo $order->user->ID?>"><?php echo $order->user->user_login?></a>
932
<?php } else { ?>
933
[<?php _e('deleted', 'pmpro');?>]
934
<?php } ?>
935
- </td>
936
<?php do_action("pmpro_orders_extra_cols_body", $order);?>
937
<td><?php echo $order->membership_id;?></td>
938
<td><?php echo pmpro_formatPrice($order->total);?></td>
@@ -942,9 +960,9 @@
942
<?php echo $order->cardtype;?>: x<?php echo last4($order->accountnumber);?><br />
943
<?php } ?>
944
<?php if(!empty($order->billing->street)) { ?>
945
- <?php echo $order->billing->street; ?><br />
946
<?php if( $order->billing->city && $order->billing->state) { ?>
947
- <?php echo $order->billing->city?>, <?php echo $order->billing->state?> <?php echo $order->billing->zip?> <?php if(!empty( $order->billing->country)) echo $order->billing->country?><br />
948
<?php } ?>
949
<?php } ?>
950
<?php if(!empty($order->billing->phone)) echo formatPhone($order->billing->phone);?>
@@ -953,7 +971,7 @@
953
<td>
954
<?php _e('Payment', 'pmpro');?>: <?php if(!empty($order->payment_transaction_id)) echo $order->payment_transaction_id; else echo "N/A";?>
955
<br />
956
- <?php _e('Subscription', 'pmpro');?>: <?php if(!empty($order->subscription_transaction_id)) echo $order->subscription_transaction_id; else echo "N/A";?>
957
</td>
958
<td><?php echo $order->status;?></td>
959
<td><?php echo date(get_option('date_format'), $order->timestamp);?></td>
@@ -969,7 +987,7 @@
969
</tr>
970
<?php
971
}
972
-
973
if(!$order_ids)
974
{
975
?>
@@ -978,19 +996,19 @@
978
</tr>
979
<?php
980
}
981
- ?>
982
</tbody>
983
</table>
984
</form>
985
-
986
<?php
987
//add normal args
988
- $pagination_url = add_query_arg($url_params, get_admin_url(NULL, "/admin.php?page=pmpro-orders"));
989
echo pmpro_getPaginationString($pn, $totalrows, $limit, 1, $pagination_url, "&limit=$limit&pn=");
990
?>
991
992
<?php } ?>
993
-
994
<?php
995
- require_once(dirname(__FILE__) . "/admin_footer.php");
996
?>
3
if(!function_exists("current_user_can") || (!current_user_can("manage_options") && !current_user_can("pmpro_orders")))
4
{
5
die(__("You do not have permissions to perform this action.", "pmpro"));
6
+ }
7
+
8
//vars
9
global $wpdb;
10
if(isset($_REQUEST['s']))
11
$s = $_REQUEST['s'];
12
else
13
$s = "";
14
+
15
if(isset($_REQUEST['l']))
16
$l = $_REQUEST['l'];
17
else
18
$l = false;
19
+
20
if(isset($_REQUEST['start-month']))
21
$start_month = $_REQUEST['start-month'];
22
else
23
$start_month = "1";
24
+
25
if(isset($_REQUEST['start-day']))
26
$start_day = $_REQUEST['start-day'];
27
else
28
$start_day = "1";
29
+
30
if(isset($_REQUEST['start-year']))
31
$start_year = $_REQUEST['start-year'];
32
else
33
$start_year = date("Y");
34
+
35
if(isset($_REQUEST['end-month']))
36
$end_month = $_REQUEST['end-month'];
37
else
38
$end_month = date("n");
39
+
40
if(isset($_REQUEST['end-day']))
41
$end_day = $_REQUEST['end-day'];
42
else
43
$end_day = date("j");
44
+
45
if(isset($_REQUEST['end-year']))
46
$end_year = $_REQUEST['end-year'];
47
else
48
+ $end_year = date("Y");
49
+
50
if(isset($_REQUEST['predefined-date']))
51
$predefined_date = $_REQUEST['predefined-date'];
52
else
53
+ $predefined_date = "This Month";
54
+
55
if(isset($_REQUEST['status']))
56
$status = $_REQUEST['status'];
57
else
58
$status = "";
59
+
60
+
61
//deleting?
62
if(!empty($_REQUEST['delete']))
63
{
73
$pmpro_msgt = "error";
74
}
75
}
76
+
77
if(isset($_REQUEST['filter']))
78
$filter = sanitize_text_field($_REQUEST['filter']);
79
else
80
$filter = "all";
81
+
82
$thisyear = date("Y");
83
+
84
+
85
+
86
//this array stores fields that should be read only
87
$read_only_fields = apply_filters("pmpro_orders_read_only_fields", array("code", "payment_transaction_id", "subscription_transaction_id"));
88
+
89
//saving?
90
if(!empty($_REQUEST['save']))
91
{
95
$order = new MemberOrder($order_id);
96
else
97
$order = new MemberOrder();
98
+
99
//update values
100
if(!in_array("code", $read_only_fields))
101
$order->code = $_POST['code'];
105
$order->membership_id = intval($_POST['membership_id']);
106
if(!in_array("billing_name", $read_only_fields))
107
$order->billing->name = stripslashes($_POST['billing_name']);
108
+ if(!in_array("billing_street", $read_only_fields))
109
$order->billing->street = stripslashes($_POST['billing_street']);
110
if(!in_array("billing_city", $read_only_fields))
111
$order->billing->city = stripslashes($_POST['billing_city']);
132
if(!in_array("accountnumber", $read_only_fields))
133
$order->accountnumber = $_POST['accountnumber'];
134
if(!in_array("expirationmonth", $read_only_fields))
135
+ $order->expirationmonth = $_POST['expirationmonth'];
136
if(!in_array("expirationyear", $read_only_fields))
137
$order->expirationyear = $_POST['expirationyear'];
138
if(!in_array("ExpirationDate", $read_only_fields))
149
$order->subscription_transaction_id = $_POST['subscription_transaction_id'];
150
if(!in_array("notes", $read_only_fields))
151
$order->notes = stripslashes($_POST['notes']);
152
+
153
//affiliate stuff
154
$affiliates = apply_filters("pmpro_orders_show_affiliate_ids", false);
155
if(!empty($affiliates))
159
if(!in_array("affiliate_subid", $read_only_fields))
160
$order->affiliate_subid = $_POST['affiliate_subid'];
161
}
162
+
163
//save
164
if($order->saveOrder() !== false)
165
+ {
166
//handle timestamp
167
if($order->updateTimestamp($_POST['ts_year'], $_POST['ts_month'], $_POST['ts_day']) !== false)
168
{
174
$pmpro_msg = __("Error updating order timestamp.", "pmpro");
175
$pmpro_msgt = "error";
176
}
177
+ }
178
else
179
{
180
$pmpro_msg = __("Error saving order.", "pmpro");
182
}
183
}
184
else
185
+ {
186
//order passed?
187
if(!empty($_REQUEST['order']))
188
{
192
elseif(!empty($_REQUEST['copy']))
193
{
194
$order = new MemberOrder(intval($_REQUEST['copy']));
195
+
196
//new id
197
$order->id = NULL;
198
+
199
//new code
200
$order->code = $order->getRandomCode();
201
}
202
else
203
{
204
$order = new MemberOrder(); //new order
205
+
206
//defaults
207
$order->code = $order->getRandomCode();
208
$order->user_id = "";
222
$order->cardtype = "";
223
$order->accountnumber = "";
224
$order->expirationmonth = "";
225
+ $order->expirationyear = "";
226
$order->status = "success";
227
$order->gateway = pmpro_getOption("gateway");
228
$order->gateway_environment = pmpro_getOption("gateway_environment");
234
}
235
}
236
}
237
+
238
+ require_once(dirname(__FILE__) . "/admin_header.php");
239
?>
240
241
<?php if(!empty($order)) { ?>
247
<?php _e('New Order', 'pmpro');?>
248
<?php } ?>
249
</h2>
250
+
251
<?php if(!empty($pmpro_msg)) { ?>
252
<div id="message" class="<?php if($pmpro_msgt == "success") echo "updated fade"; else echo "error"; ?>"><p><?php echo $pmpro_msg?></p></div>
253
<?php } ?>
254
+
255
<form method="post" action="">
256
+
257
<table class="form-table">
258
<tbody>
259
<tr>
260
<th scope="row" valign="top"><label>ID:</label></th>
261
<td><?php if(!empty($order->id)) echo $order->id; else echo __("This will be generated when you save.", "pmpro");?></td>
262
+ </tr>
263
+
264
<tr>
265
<th scope="row" valign="top"><label for="code"><?php _e('Code', 'pmpro');?>:</label></th>
266
<td>
270
<?php if($order_id < 0) { ?><small class="pmpro_lite"><?php _e('Randomly generated for you.', 'pmpro');?></small><?php } ?>
271
</td>
272
</tr>
273
+
274
<tr>
275
<th scope="row" valign="top"><label for="user_id"><?php _e('User ID', 'pmpro');?>:</label></th>
276
<td>
279
<?php } ?>
280
</td>
281
</tr>
282
+
283
<tr>
284
<th scope="row" valign="top"><label for="membership_id"><?php _e('Membership Level ID', 'pmpro');?>:</label></th>
285
<td>
288
<?php } ?>
289
</td>
290
</tr>
291
+
292
<tr>
293
<th scope="row" valign="top"><label for="billing_name"><?php _e('Billing Name', 'pmpro');?>:</label></th>
294
<td>
296
<input id="billing_name" name="billing_name" type="text" size="50" value="<?php echo esc_attr($order->billing->name);?>" />
297
<?php } ?>
298
</td>
299
+ </tr>
300
<tr>
301
<th scope="row" valign="top"><label for="billing_street"><?php _e('Billing Street', 'pmpro');?>:</label></th>
302
<td>
341
<?php } ?>
342
</td>
343
</tr>
344
+
345
<tr>
346
<th scope="row" valign="top"><label for="subtotal"><?php _e('Sub Total', 'pmpro');?>:</label></th>
347
<td>
348
<?php if(in_array("subtotal", $read_only_fields) && $order_id > 0) { echo $order->subtotal; } else { ?>
349
+ <input id="subtotal" name="subtotal" type="text" size="10" value="<?php echo esc_attr($order->subtotal);?>" />
350
<?php } ?>
351
</td>
352
</tr>
354
<th scope="row" valign="top"><label for="tax"><?php _e('Tax', 'pmpro');?>:</label></th>
355
<td>
356
<?php if(in_array("tax", $read_only_fields) && $order_id > 0) { echo $order->tax; } else { ?>
357
+ <input id="tax" name="tax" type="text" size="10" value="<?php echo esc_attr($order->tax);?>" />
358
<?php } ?>
359
</td>
360
</tr>
369
<tr>
370
<th scope="row" valign="top"><label for="total"><?php _e('Total', 'pmpro');?>:</label></th>
371
<td>
372
+ <?php if(in_array("total", $read_only_fields) && $order_id > 0) { echo $order->total; } else { ?>
373
<input id="total" name="total" type="text" size="10" value="<?php echo esc_attr($order->total);?>" />
374
<?php } ?>
375
+ <small class="pmpro_lite"><?php _e('Should be subtotal + tax - couponamount.', 'pmpro');?></small>
376
</td>
377
</tr>
378
+
379
<tr>
380
<th scope="row" valign="top"><label for="payment_type"><?php _e('Payment Type', 'pmpro');?>:</label></th>
381
<td>
382
<?php if(in_array("payment_type", $read_only_fields) && $order_id > 0) { echo $order->payment_type; } else { ?>
383
<input id="payment_type" name="payment_type" type="text" size="50" value="<?php echo esc_attr($order->payment_type);?>" />
384
<?php } ?>
385
+ <small class="pmpro_lite"><?php _e('e.g. PayPal Express, PayPal Standard, Credit Card.', 'pmpro');?></small>
386
</td>
387
</tr>
388
<tr>
418
<small class="pmpro_lite">YYYY</small>
419
</td>
420
</tr>
421
+ <?php } ?>
422
<tr>
423
<th scope="row" valign="top"><label for="status"><?php _e('Status', 'pmpro');?>:</label></th>
424
<td>
429
$used_statuses = $wpdb->get_col("SELECT DISTINCT(status) FROM $wpdb->pmpro_membership_orders");
430
$statuses = array_unique(array_merge($default_statuses, $used_statuses));
431
asort($statuses);
432
+ $statuses = apply_filters("pmpro_order_statuses", $statuses);
433
?>
434
<select id="status" name="status">
435
<?php foreach($statuses as $status) { ?>
436
<option value="<?php echo esc_attr($status);?>" <?php selected($order->status, $status);?>><?php echo $status;?></option>
437
<?php } ?>
438
+ </select>
439
<?php } ?>
440
</td>
441
</tr>
442
+
443
<tr>
444
<th scope="row" valign="top"><label for="gateway"><?php _e('Gateway', 'pmpro');?>:</label></th>
445
<td>
446
<?php if(in_array("gateway", $read_only_fields) && $order_id > 0) { echo $order->gateway; } else { ?>
447
<select id="gateway" name="gateway" onchange="pmpro_changeGateway(jQuery(this).val());">
448
+ <?php
449
+ $pmpro_gateways = pmpro_gateways();
450
+ foreach($pmpro_gateways as $pmpro_gateway_name => $pmpro_gateway_label)
451
+ {
452
+ ?>
453
+ <option value="<?php echo esc_attr($pmpro_gateway_name);?>" <?php selected($order->gateway, $pmpro_gateway_name);?>><?php echo $pmpro_gateway_label;?></option>
454
+ <?php
455
+ }
456
+ ?>
457
+ </select>
458
<?php } ?>
459
</td>
460
</tr>
469
<?php } ?>
470
</td>
471
</tr>
472
+
473
<tr>
474
<th scope="row" valign="top"><label for="payment_transaction_id"><?php _e('Payment Transaction ID', 'pmpro');?>:</label></th>
475
<td>
488
<small class="pmpro_lite"><?php _e('Generated by the gateway. Useful to cross reference subscriptions.', 'pmpro');?></small>
489
</td>
490
</tr>
491
+
492
<tr>
493
<th scope="row" valign="top"><label for="ts_month"><?php _e('Date', 'pmpro');?>:</label></th>
494
<td>
499
$timestamp = $order->timestamp;
500
else
501
$timestamp = current_time('timestamp');
502
$year = date("Y", $timestamp);
503
$month = date("n", $timestamp);
504
$day = date("j", $timestamp);
505
?>
506
<select id="ts_month" name="ts_month">
507
+ <?php
508
for($i = 1; $i < 13; $i++)
509
{
510
?>
518
<?php } ?>
519
</td>
520
</tr>
521
+
522
+ <?php
523
$affiliates = apply_filters("pmpro_orders_show_affiliate_ids", false);
524
+ if(!empty($affiliates)) {
525
?>
526
<tr>
527
<th scope="row" valign="top"><label for="affiliate_id"><?php _e('Affiliate ID', 'pmpro');?>Affiliate ID:</label></th>
529
<?php if(in_array("affiliate_id", $read_only_fields) && $order_id > 0) { echo $order->affiliate_id; } else { ?>
530
<input id="affiliate_id" name="affiliate_id" type="text" size="50" value="<?php echo esc_attr($order->affiliate_id);?>" />
531
<?php } ?>
532
+ </td>
533
</tr>
534
<tr>
535
<th scope="row" valign="top"><label for="affiliate_subid"><?php _e('Affiliate SubID', 'pmpro');?>Affiliate SubID:</label></th>
540
</td>
541
</tr>
542
<?php } ?>
543
+
544
<tr>
545
<th scope="row" valign="top"><label for="notes"><?php _e('Notes', 'pmpro');?>:</label></th>
546
<td>
549
<?php } ?>
550
</td>
551
</tr>
552
+
553
+ <?php do_action("pmpro_after_order_settings", $order); ?>
554
+
555
</tbody>
556
</table>
557
+
558
<p class="submit topborder">
559
<input name="order" type="hidden" value="<?php if(!empty($order->id)) echo $order->id; else echo $order_id;?>" />
560
+ <input name="save" type="submit" class="button-primary" value="<?php _e('Save Order', 'pmpro');?>" />
561
+ <input name="cancel" type="button" class="cancel button-secondary" value="<?php _e('Cancel', 'pmpro');?>" onclick="location.href='<?php echo get_admin_url(NULL, '/admin.php?page=pmpro-orders')?>';" />
562
</p>
563
+
564
</form>
565
566
<?php } else { ?>
567
+
568
+ <form id="posts-filter" method="get" action="">
569
<h2>
570
<?php _e('Orders', 'pmpro');?>
571
<a href="admin.php?page=pmpro-orders&order=-1" class="add-new-h2">+ <?php _e('Add New Order', 'pmpro');?></a>
572
+
573
<?php
574
//build the export URL
575
$export_url = admin_url('admin-ajax.php') . "?action=orders_csv";
584
"end-day"=>$end_day,
585
"end-year"=>$end_year,
586
"predefined-date"=>$predefined_date,
587
+ "status"=>$status
588
+ );
589
$export_url = add_query_arg($url_params, $export_url);
590
+ ?>
591
<a target="_blank" href="<?php echo $export_url;?>" class="add-new-h2"><?php _e('Export to CSV', 'pmpro');?></a>
592
</h2>
593
+
594
+
595
596
<?php if(!empty($pmpro_msg)) { ?>
597
<div id="message" class="<?php if($pmpro_msgt == "success") echo "updated fade"; else echo "error"; ?>"><p><?php echo $pmpro_msg?></p></div>
598
<?php } ?>
599
+
600
+
601
<ul class="subsubsub">
602
+ <li>
603
<?php _ex('Show', 'Dropdown label, e.g. Show Daily Orders for January', 'pmpro')?>
604
<select id="filter" name="filter">
605
<option value="all" <?php selected($filter, "all");?>><?php _e('All', 'pmpro');?></option>
608
<option value="within-a-level" <?php selected($filter, "within-a-level");?>><?php _e('Within a Level', 'pmpro');?></option>
609
<option value="within-a-status" <?php selected($filter, "within-a-status");?>><?php _e('Within a Status', 'pmpro');?></option>
610
</select>
611
+
612
<span id="from"><?php _ex('From', 'Dropdown label', 'pmpro')?></span>
613
+
614
<select id="start-month" name="start-month">
615
<?php for($i = 1; $i < 13; $i++) { ?>
616
<option value="<?php echo $i;?>" <?php selected($start_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i, 2));?></option>
617
<?php } ?>
618
</select>
619
+
620
<input id='start-day' name="start-day" type="text" size="2" value="<?php echo $start_day?>" />
621
<input id='start-year' name="start-year" type="text" size="4" value="<?php echo $start_year?>" />
622
628
<option value="<?php echo $i;?>" <?php selected($end_month, $i);?>><?php echo date("F", mktime(0, 0, 0, $i,2));?></option>
629
<?php } ?>
630
</select>
631
+
632
633
<input id='end-day' name="end-day" type="text" size="2" value="<?php echo $end_day?>" />
634
<input id='end-year' name="end-year" type="text" size="4" value="<?php echo $end_year?>" />
635
+
636
<span id="filterby"><?php _ex('filter by ', 'Dropdown label', 'pmpro')?></span>
637
+
638
<select id="predefined-date" name="predefined-date">
639
+
640
<option value="<?php echo "This Month";?>" <?php selected($predefined_date, "This Month");?>><?php echo "This Month";?></option>
641
<option value="<?php echo "Last Month";?>" <?php selected($predefined_date, "Last Month");?>><?php echo "Last Month";?></option>
642
<option value="<?php echo "This Year";?>" <?php selected($predefined_date, "This Year");?>><?php echo "This Year";?></option>
643
<option value="<?php echo "Last Year";?>" <?php selected($predefined_date, "Last Year");?>><?php echo "Last Year";?></option>
644
+
645
</select>
646
647
<?php
648
//Note: only orders belonging to current levels can be filtered. There is no option for orders belonging to deleted levels
649
+ $levels = pmpro_getAllLevels();
650
+
651
?>
652
<select id="l" name="l">
653
<?php foreach($levels as $level) { ?>
654
+ <option value="<?php echo $level->id;?>" <?php selected($l, $level->id);?>><?php echo $level->name;?></option>
655
<?php } ?>
656
+
657
</select>
658
+
659
<?php
660
$statuses = array();
661
$default_statuses = array("", "success", "cancelled", "review", "token", "refunded");
662
$used_statuses = $wpdb->get_col("SELECT DISTINCT(status) FROM $wpdb->pmpro_membership_orders");
663
$statuses = array_unique(array_merge($default_statuses, $used_statuses));
664
asort($statuses);
665
+ $statuses = apply_filters("pmpro_order_statuses", $statuses);
666
?>
667
<select id="status" name="status">
668
<?php foreach($statuses as $the_status) { ?>
669
<option value="<?php echo esc_attr($the_status);?>" <?php selected($the_status, $status);?>><?php echo $the_status;?></option>
670
<?php } ?>
671
+ </select>
672
+
673
+
674
<input id="submit" type="submit" value="<?php _ex('Filter', 'Submit button value.', 'pmpro');?>" />
675
</li>
676
</ul>
677
+
678
<script>
679
//update month/year when period dropdown is changed
680
jQuery(document).ready(function() {
682
pmpro_ShowMonthOrYear();
683
});
684
});
685
+
686
function pmpro_ShowMonthOrYear()
687
{
688
var filter = jQuery('#filter').val();
767
jQuery('#filterby').show();
768
}
769
}
770
+
771
pmpro_ShowMonthOrYear();
772
+
773
+
774
</script>
775
+
776
<p class="search-box">