Paid Memberships Pro - Version 2.3

Version Description

  • 2020-05-01 =
  • FEATURE: Added frontend login and password reset.
  • FEATURE: Added frontend user profile editing.
  • FEATURE: Added [pmpro_login] shortcode and Log In Form block.
  • FEATURE: Added [pmpro_member_profile_edit] shortcode and Member Profile Edit block.
  • FEATURE: Added "Member Log In" widget.
  • FEATURE: Added "WordPress Toolbar" Advanced Setting to hide the WordPress Toolbar from "subscriber" role.
  • FEATURE: Added "WordPress Dashboard" Advanced Setting to block dashboard access for the "subscriber" role.
  • FEATURE: Added new Admin Activity Email. Weekly emails to the site admin with sales stats and other info. Change how often the email is sent or disable it from the advanced settings tab.
  • FEATURE: Added Beaver Builder module compatibility to restrict modules by membership level.
  • FEATURE: Created new REST API endpoints and extended existing endpoints.
  • FEATURE: Updated Elementor code to allow for restriction of "sections" as well.
  • BUG FIX: Updated all timestamp code to be compatible with WordPress v5.4+ which fixes issues where orders could lose one hour or one day when saved.
  • BUG FIX: Updated logic to filter body_class on pages with Membership Account shortcode or any "section" of the shortcode displayed.
  • BUG FIX: Improved pmpro_getAllLevels function to cache even when force is true. This saves multiple DB hits per page load.
  • BUG FIX/ENHANCEMENT: Cancellation report now calculates based on membership enddate.
  • BUG FIX/ENHANCEMENT: Fixed warnings and errors in PHP 7.4+.
  • BUG FIX/ENHANCEMENT: Now allowing translation for text generated by JavaScript.
  • BUG FIX/ENHANCEMENT: Updated all uses of "Email" to remove the hyphen.
  • BUG FIX/ENHANCEMENT: Updated to default to international addresses on Billing Information page. Fixes a bug with the State Dropdown Add-On.
  • BUG FIX/ENHANCEMENT: Now treating "recurring_payment_failed" transactions from PayPal IPN as cancellations. PMPro will cancel membership and attempt to cancel the associated subscription.
  • ENHANCEMENT: Added membership level class for the PMPro_Membership_Level object. This is currently only used in the REST API calls, but will eventually be used whenever interacting with a membership level object or array.
  • ENHANCEMENT: Added discount code class for the PMPro_Discount_Code object. This is currently only used in the REST API calls, but will eventually be used whnever interacting with a discount code object or array.
  • ENHANCEMENT: Now allowing all users and members access to the Membership Account page.
  • ENHANCEMENT: Updating logic for all redirects from core pages like Invoices, Billing, and Cancel to allow past members to access their data. Generally more often redirecting where you would expect to in different situations.
  • ENHANCEMENT: Several core frontend page style improvements for responsive displays and gateway-dependent fields.
  • ENHANCEMENT: Added getSubscriptionStatus method to the Stripe gateway API class. This fixes issues with the PMPro Subscription Check Add-On.
  • ENHANCEMENT: Added !!levels_page_url!! and !!login_url!! as replacement variables in Advanced Settings > Message Settings. Using these by default on new installs.
  • ENHANCEMENT: Improved Block Editor code and webpack configuration.
  • ENHANCEMENT: Added support for PMPRO_AUTHNET_SILENT_POST_DEBUG to "log" data to /logs/ or send an email to an email address different from the site admin.
  • ENHANCEMENT: Added time fields to Memberships > Orders admin page when vieweing, updating or saving an order.
  • ENHANCEMENT: Added pmpro_admin_orders_filters and pmpro_admin_orders_query_condition filters to add new filters to the orders page in the dashboard. (Thanks, Mirco Babini)
  • ENHANCEMENT: Added an SVG icon to the PMPro blocks category.
  • REFACTOR: Improved the Members List list table code to use a function for each column of data and support the code core WP methods for extending list tables with custom columns.
  • REFACTOR: Moved all Theme My Login compatiblity code to includes/compatibility/theme-my-login.php and only loading if plugin is active.
Download this release

Release Info

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

Code changes from version 2.2.6 to 2.3

Files changed (176) hide show
  1. CHANGELOG.txt +38 -2
  2. adminpages/advancedsettings.php +406 -326
  3. adminpages/dashboard.php +11 -5
  4. adminpages/discountcodes.php +17 -15
  5. adminpages/license.php +4 -4
  6. adminpages/orders.php +50 -29
  7. adminpages/pagesettings.php +110 -2
  8. adminpages/reports/memberships.php +22 -22
  9. adminpages/reports/sales.php +41 -21
  10. blocks/account-invoices-section/block.js +6 -24
  11. blocks/account-invoices-section/editor.css +0 -19
  12. blocks/account-links-section/block.js +6 -24
  13. blocks/account-links-section/editor.css +0 -19
  14. blocks/account-membership-section/block.js +6 -24
  15. blocks/account-membership-section/editor.css +0 -19
  16. blocks/account-page/block.js +5 -21
  17. blocks/account-page/editor.css +0 -19
  18. blocks/account-page/inspector.js +5 -6
  19. blocks/account-profile-section/block.js +6 -24
  20. blocks/account-profile-section/editor.css +0 -19
  21. blocks/billing-page/block.js +6 -24
  22. blocks/billing-page/editor.css +0 -19
  23. blocks/blocks.js +90 -0
  24. blocks/blocks.php +8 -1
  25. blocks/cancel-page/block.js +6 -24
  26. blocks/cancel-page/editor.css +0 -19
  27. blocks/checkout-button/block.js +4 -14
  28. blocks/checkout-button/editor.css +0 -27
  29. blocks/checkout-button/inspector.js +4 -5
  30. blocks/checkout-page/block.js +5 -14
  31. blocks/checkout-page/editor.css +0 -22
  32. blocks/checkout-page/inspector.js +1 -1
  33. blocks/confirmation-page/block.js +6 -24
  34. blocks/confirmation-page/editor.css +0 -19
  35. blocks/invoice-page/block.js +6 -24
  36. blocks/invoice-page/editor.css +0 -19
  37. blocks/levels-page/block.js +6 -24
  38. blocks/levels-page/editor.css +0 -19
  39. blocks/login/block.js +55 -0
  40. blocks/login/block.php +62 -0
  41. blocks/login/inspector.js +60 -0
  42. blocks/member-profile-edit/block.js +43 -0
  43. blocks/member-profile-edit/block.php +48 -0
  44. blocks/membership/block.js +21 -22
  45. blocks/membership/editor.css +0 -14
  46. classes/class-pmpro-admin-activity-email.php +418 -0
  47. classes/class-pmpro-discount-codes.php +285 -0
  48. classes/class-pmpro-levels.php +262 -0
  49. classes/class-pmpro-members-list-table.php +167 -284
  50. classes/class.memberorder.php +22 -10
  51. classes/class.pmproemail.php +17 -17
  52. classes/gateways/class.pmprogateway_paypalexpress.php +7 -6
  53. classes/gateways/class.pmprogateway_stripe.php +16 -1
  54. css/blocks.editor.css +87 -13
  55. css/frontend.css +186 -14
  56. includes/admin.php +15 -24
  57. includes/adminpages.php +5 -1
  58. includes/compatibility.php +10 -0
  59. includes/compatibility/beaver-builder.php +152 -0
  60. includes/compatibility/elementor/class-pmpro-elementor-content-restriction.php +55 -12
  61. includes/compatibility/elementor/class-pmpro-elementor.php +4 -0
  62. includes/compatibility/theme-my-login.php +98 -0
  63. includes/compatibility/woocommerce.php +25 -0
  64. includes/content.php +3 -3
  65. includes/email.php +4 -1
  66. includes/functions.php +63 -13
  67. includes/https.php +68 -86
  68. includes/init.php +6 -1
  69. includes/lib/name-parser.php +2 -2
  70. includes/login.php +873 -135
  71. includes/menus.php +255 -0
  72. includes/notifications.php +4 -1
  73. includes/profile.php +318 -18
  74. includes/rest-api.php +484 -16
  75. includes/scripts.php +25 -0
  76. includes/updates/upgrade_1.php +3 -4
  77. includes/upgradecheck.php +11 -6
  78. includes/widgets.php +135 -0
  79. js/blocks.build.js +1 -0
  80. js/editor.blocks.js +0 -1
  81. js/pmpro-login.js +63 -0
  82. languages/paid-memberships-pro-ca.mo +0 -0
  83. languages/paid-memberships-pro-ca.po +3 -3
  84. languages/paid-memberships-pro-ca_AD.mo +0 -0
  85. languages/paid-memberships-pro-ca_AD.po +3 -3
  86. languages/paid-memberships-pro-ca_ES.mo +0 -0
  87. languages/paid-memberships-pro-ca_ES.po +3 -3
  88. languages/paid-memberships-pro-cs_CZ.mo +0 -0
  89. languages/paid-memberships-pro-cs_CZ.po +3 -3
  90. languages/paid-memberships-pro-da_DK.mo +0 -0
  91. languages/paid-memberships-pro-da_DK.po +3 -3
  92. languages/paid-memberships-pro-de_DE.mo +0 -0
  93. languages/paid-memberships-pro-de_DE.po +3 -3
  94. languages/paid-memberships-pro-el_GR.mo +0 -0
  95. languages/paid-memberships-pro-el_GR.po +3 -3
  96. languages/paid-memberships-pro-en_GB.mo +0 -0
  97. languages/paid-memberships-pro-en_GB.po +3 -3
  98. languages/paid-memberships-pro-es_CL.mo +0 -0
  99. languages/paid-memberships-pro-es_CL.po +3 -3
  100. languages/paid-memberships-pro-es_CL.pot +3 -3
  101. languages/paid-memberships-pro-es_ES.mo +0 -0
  102. languages/paid-memberships-pro-es_ES.po +3 -3
  103. languages/paid-memberships-pro-es_ES.pot +3 -3
  104. languages/paid-memberships-pro-es_PE.mo +0 -0
  105. languages/paid-memberships-pro-es_PE.po +3 -3
  106. languages/paid-memberships-pro-es_PE.pot +3 -3
  107. languages/paid-memberships-pro-et_EE.mo +0 -0
  108. languages/paid-memberships-pro-et_EE.po +3 -3
  109. languages/paid-memberships-pro-fa_IR.mo +0 -0
  110. languages/paid-memberships-pro-fa_IR.po +3 -3
  111. languages/paid-memberships-pro-fi.mo +0 -0
  112. languages/paid-memberships-pro-fi.po +3 -3
  113. languages/paid-memberships-pro-fr_FR.mo +0 -0
  114. languages/paid-memberships-pro-fr_FR.po +3 -3
  115. languages/paid-memberships-pro-he_IL.mo +0 -0
  116. languages/paid-memberships-pro-he_IL.po +3 -3
  117. languages/paid-memberships-pro-it_IT.mo +0 -0
  118. languages/paid-memberships-pro-it_IT.po +3 -3
  119. languages/paid-memberships-pro-nb_NO.mo +0 -0
  120. languages/paid-memberships-pro-nb_NO.po +3 -3
  121. languages/paid-memberships-pro-nl_NL.mo +0 -0
  122. languages/paid-memberships-pro-nl_NL.po +3 -3
  123. languages/paid-memberships-pro-pt_BR.mo +0 -0
  124. languages/paid-memberships-pro-pt_BR.po +3 -3
  125. languages/paid-memberships-pro-pt_PT.mo +0 -0
  126. languages/paid-memberships-pro-pt_PT.po +3 -3
  127. languages/paid-memberships-pro-sk_SK.mo +0 -0
  128. languages/paid-memberships-pro-sk_SK.po +3 -3
  129. languages/paid-memberships-pro-sr_RS.mo +0 -0
  130. languages/paid-memberships-pro-sr_RS.po +3 -3
  131. languages/paid-memberships-pro-sv_SE.mo +0 -0
  132. languages/paid-memberships-pro-sv_SE.po +3 -3
  133. languages/paid-memberships-pro-tr_TR.mo +0 -0
  134. languages/paid-memberships-pro-tr_TR.po +3 -3
  135. languages/paid-memberships-pro-vi_VN.mo +0 -0
  136. languages/paid-memberships-pro-vi_VN.po +3 -3
  137. languages/paid-memberships-pro-zh_HK.mo +0 -0
  138. languages/paid-memberships-pro-zh_HK.po +3 -3
  139. languages/paid-memberships-pro.mo +0 -0
  140. languages/paid-memberships-pro.po +1495 -1002
  141. languages/paid-memberships-pro.pot +1495 -1002
  142. license.txt +1 -1
  143. pages/billing.php +27 -17
  144. pages/cancel.php +1 -1
  145. pages/checkout.php +4 -4
  146. pages/confirmation.php +8 -10
  147. pages/invoice.php +5 -9
  148. pages/levels.php +7 -9
  149. pages/login.php +3 -0
  150. pages/member_profile_edit.php +3 -0
  151. paid-memberships-pro.php +15 -4
  152. preheaders/account.php +44 -26
  153. preheaders/billing.php +10 -5
  154. preheaders/cancel.php +34 -18
  155. preheaders/checkout.php +2 -2
  156. preheaders/confirmation.php +25 -10
  157. preheaders/invoice.php +30 -22
  158. preheaders/login.php +5 -0
  159. preheaders/member_profile_edit.php +10 -0
  160. readme.txt +122 -61
  161. scheduled/adminactivityemail.php +10 -0
  162. scheduled/crons.php +28 -11
  163. screenshot-1.jpg +0 -0
  164. screenshot-2.jpg +0 -0
  165. screenshot-3.jpg +0 -0
  166. screenshot-4.jpg +0 -0
  167. screenshot-5.jpg +0 -0
  168. screenshot-6.jpg +0 -0
  169. screenshot-7.jpg +0 -0
  170. screenshot-8.jpg +0 -0
  171. services/authnet-silent-post.php +24 -6
  172. services/ipnhandler.php +2 -2
  173. shortcodes/pmpro_account.php +99 -24
  174. shortcodes/pmpro_login.php +43 -0
  175. shortcodes/pmpro_member_profile_edit.php +35 -0
  176. uninstall.php +3 -1
CHANGELOG.txt CHANGED
@@ -1,4 +1,40 @@
1
== Changelog ==
2
= 2.2.6 - 2020-02-20 =
3
* SECURITY: Escaping the post title shown in the Terms of Service section of the checkout page.
4
* BUG FIX: Fixed issue where the CVV/Security Code was not being passed to Authorize.net when using that gateway.
@@ -203,13 +239,13 @@
203
* BUG FIX/ENHANCEMENT: Brought back the Stripe Billing limit warnings. Here is a plugin to get billing limits working with Stripe https://github.com/strangerstudios/pmpro-stripe-billing-limits/blob/master/pmpro-stripe-billing-limits.php
204
* FEATURE: Gutenberg / v5.0 Editor Blocks for Paid Memberships Pro pages, the Checkout Button and Membership "shortcode" functionality.
205
* FEATURE: Added new "Dashboard" page and adjusted the entire menu structure for "Memberships".
206
- * FEATURE: Created new compatibility checks and included compatability functions for Beaver Builder, Elementor, and SiteOrigin Page Builder.
207
* FEATURE: Added REST API routes for post membership access, and user membership level.
208
* FEATURE: Added option to include the level's Confirmation Message in the Confirmation Email.
209
* FEATURE: Added a filter by discount code to Memberships and Sales reports.
210
* FEATURE: Added a filter by discount code to the Orders admin page.
211
* FEATURE: Added a "Copy" option to discount codes.
212
- * FEATURE: Now allowing you to edit or add a discount code to a single Order edit.
213
* FEATURE: Added the ability to export orders by discount code used.
214
* FEATURE: Added new file for deprecated functions or hooks.
215
* ENHANCEMENT: Moved "Memberships" menu page up in sidebar below Comments.
1
== Changelog ==
2
+ = 2.3 - 2020-05-01 =
3
+ * FEATURE: Added frontend login and password reset.
4
+ * FEATURE: Added frontend user profile editing.
5
+ * FEATURE: Added [pmpro_login] shortcode and Log In Form block.
6
+ * FEATURE: Added [pmpro_member_profile_edit] shortcode and Member Profile Edit block.
7
+ * FEATURE: Added "Member Log In" widget.
8
+ * FEATURE: Added "WordPress Toolbar" Advanced Setting to hide the WordPress Toolbar from "subscriber" role.
9
+ * FEATURE: Added "WordPress Dashboard" Advanced Setting to block dashboard access for the "subscriber" role.
10
+ * FEATURE: Added new Admin Activity Email. Weekly emails to the site admin with sales stats and other info. Change how often the email is sent or disable it from the advanced settings tab.
11
+ * FEATURE: Added Beaver Builder module compatibility to restrict modules by membership level.
12
+ * FEATURE: Created new REST API endpoints and extended existing endpoints.
13
+ * FEATURE: Updated Elementor code to allow for restriction of "sections" as well.
14
+ * BUG FIX: Updated all timestamp code to be compatible with WordPress v5.4+ which fixes issues where orders could lose one hour or one day when saved.
15
+ * BUG FIX: Updated logic to filter body_class on pages with Membership Account shortcode or any "section" of the shortcode displayed.
16
+ * BUG FIX: Improved `pmpro_getAllLevels` function to cache even when `force` is `true`. This saves multiple DB hits per page load.
17
+ * BUG FIX/ENHANCEMENT: Cancellation report now calculates based on membership enddate.
18
+ * BUG FIX/ENHANCEMENT: Fixed warnings and errors in PHP 7.4+.
19
+ * BUG FIX/ENHANCEMENT: Now allowing translation for text generated by JavaScript.
20
+ * BUG FIX/ENHANCEMENT: Updated all uses of "Email" to remove the hyphen.
21
+ * BUG FIX/ENHANCEMENT: Updated to default to international addresses on Billing Information page. Fixes a bug with the State Dropdown Add-On.
22
+ * BUG FIX/ENHANCEMENT: Now treating "recurring_payment_failed" transactions from PayPal IPN as cancellations. PMPro will cancel membership and attempt to cancel the associated subscription.
23
+ * ENHANCEMENT: Added membership level class for the `PMPro_Membership_Level` object. This is currently only used in the REST API calls, but will eventually be used whenever interacting with a membership level object or array.
24
+ * ENHANCEMENT: Added discount code class for the `PMPro_Discount_Code` object. This is currently only used in the REST API calls, but will eventually be used whnever interacting with a discount code object or array.
25
+ * ENHANCEMENT: Now allowing all users and members access to the Membership Account page.
26
+ * ENHANCEMENT: Updating logic for all redirects from core pages like Invoices, Billing, and Cancel to allow past members to access their data. Generally more often redirecting where you would expect to in different situations.
27
+ * ENHANCEMENT: Several core frontend page style improvements for responsive displays and gateway-dependent fields.
28
+ * ENHANCEMENT: Added `getSubscriptionStatus` method to the Stripe gateway API class. This fixes issues with the PMPro Subscription Check Add-On.
29
+ * ENHANCEMENT: Added !!levels_page_url!! and !!login_url!! as replacement variables in Advanced Settings > Message Settings. Using these by default on new installs.
30
+ * ENHANCEMENT: Improved Block Editor code and webpack configuration.
31
+ * ENHANCEMENT: Added support for `PMPRO_AUTHNET_SILENT_POST_DEBUG` to "log" data to /logs/ or send an email to an email address different from the site admin.
32
+ * ENHANCEMENT: Added time fields to Memberships > Orders admin page when vieweing, updating or saving an order.
33
+ * ENHANCEMENT: Added pmpro_admin_orders_filters and pmpro_admin_orders_query_condition filters to add new filters to the orders page in the dashboard. (Thanks, Mirco Babini)
34
+ * ENHANCEMENT: Added an SVG icon to the PMPro blocks category.
35
+ * REFACTOR: Improved the Members List list table code to use a function for each column of data and support the code core WP methods for extending list tables with custom columns.
36
+ * REFACTOR: Moved all Theme My Login compatiblity code to includes/compatibility/theme-my-login.php and only loading if plugin is active.
37
+
38
= 2.2.6 - 2020-02-20 =
39
* SECURITY: Escaping the post title shown in the Terms of Service section of the checkout page.
40
* BUG FIX: Fixed issue where the CVV/Security Code was not being passed to Authorize.net when using that gateway.
239
* BUG FIX/ENHANCEMENT: Brought back the Stripe Billing limit warnings. Here is a plugin to get billing limits working with Stripe https://github.com/strangerstudios/pmpro-stripe-billing-limits/blob/master/pmpro-stripe-billing-limits.php
240
* FEATURE: Gutenberg / v5.0 Editor Blocks for Paid Memberships Pro pages, the Checkout Button and Membership "shortcode" functionality.
241
* FEATURE: Added new "Dashboard" page and adjusted the entire menu structure for "Memberships".
242
+ * FEATURE: Created new compatibility checks and included compatability functions for Beaver Builder, Elementor, and SiteOrigin Page Builder.
243
* FEATURE: Added REST API routes for post membership access, and user membership level.
244
* FEATURE: Added option to include the level's Confirmation Message in the Confirmation Email.
245
* FEATURE: Added a filter by discount code to Memberships and Sales reports.
246
* FEATURE: Added a filter by discount code to the Orders admin page.
247
* FEATURE: Added a "Copy" option to discount codes.
248
+ * FEATURE: Now allowing you to edit or add a discount code to a single Order edit.
249
* FEATURE: Added the ability to export orders by discount code used.
250
* FEATURE: Added new file for deprecated functions or hooks.
251
* ENHANCEMENT: Moved "Memberships" menu page up in sidebar below Comments.
adminpages/advancedsettings.php CHANGED
@@ -17,7 +17,12 @@
17
//get/set settings
18
if(!empty($_REQUEST['savesettings']))
19
{
20
- //handle the text settings for better security handling
21
$nonmembertext = wp_kses(wp_unslash($_POST['nonmembertext']), $allowedposttags);
22
update_option('pmpro_nonmembertext', $nonmembertext);
23
@@ -27,25 +32,25 @@
27
$rsstext = wp_kses(wp_unslash($_POST['rsstext']), $allowedposttags);
28
update_option('pmpro_rsstext', $rsstext);
29
30
- //other settings
31
pmpro_setOption("filterqueries");
32
- pmpro_setOption("showexcerpts");
33
- pmpro_setOption("hideads");
34
- pmpro_setOption("hideadslevels");
35
- pmpro_setOption("redirecttosubscription");
36
- pmpro_setOption("maxnotificationpriority");
37
38
- //captcha
39
pmpro_setOption("recaptcha");
40
pmpro_setOption("recaptcha_version");
41
pmpro_setOption("recaptcha_publickey");
42
- pmpro_setOption("recaptcha_privatekey");
43
44
- //tos
45
- pmpro_setOption("tospage");
46
47
- //footer link
48
- pmpro_setOption("hide_footer_link");
49
50
/**
51
* Filter to add custom settings to the advanced settings page.
@@ -57,41 +62,51 @@
57
pmpro_setOption($setting['field_name']);
58
}
59
60
- //assume success
61
$msg = true;
62
$msgt = __("Your advanced settings have been updated.", 'paid-memberships-pro' );
63
}
64
65
$nonmembertext = pmpro_getOption("nonmembertext");
66
$notloggedintext = pmpro_getOption("notloggedintext");
67
$rsstext = pmpro_getOption("rsstext");
68
- $hideads = pmpro_getOption("hideads");
69
- $filterqueries = pmpro_getOption('filterqueries');
70
- $showexcerpts = pmpro_getOption("showexcerpts");
71
- $hideadslevels = pmpro_getOption("hideadslevels");
72
- $maxnotificationpriority = pmpro_getOption("maxnotificationpriority");
73
-
74
- if(is_multisite())
75
- $redirecttosubscription = pmpro_getOption("redirecttosubscription");
76
77
$recaptcha = pmpro_getOption("recaptcha");
78
$recaptcha_version = pmpro_getOption("recaptcha_version");
79
$recaptcha_publickey = pmpro_getOption("recaptcha_publickey");
80
$recaptcha_privatekey = pmpro_getOption("recaptcha_privatekey");
81
82
- $tospage = pmpro_getOption("tospage");
83
84
- $hide_footer_link = pmpro_getOption("hide_footer_link");
85
86
- //default settings
87
if(!$nonmembertext)
88
{
89
- $nonmembertext = sprintf( __( 'This content is for !!levels!! members only. <a href="%s">Register here</a>.', 'paid-memberships-pro' ), wp_login_url() . "?action=register" );
90
pmpro_setOption("nonmembertext", $nonmembertext);
91
}
92
if(!$notloggedintext)
93
{
94
- $notloggedintext = sprintf( __( 'Please <a href="%s">login</a> to view this content. (<a href="%s">Register here</a>.)', 'paid-memberships-pro' ), wp_login_url( get_permalink() ), wp_login_url() . "?action=register" );
95
pmpro_setOption("notloggedintext", $notloggedintext);
96
}
97
if(!$rsstext)
@@ -102,6 +117,10 @@
102
103
$levels = $wpdb->get_results( "SELECT * FROM {$wpdb->pmpro_membership_levels}", OBJECT );
104
105
require_once(dirname(__FILE__) . "/admin_header.php");
106
?>
107
@@ -110,318 +129,379 @@
110
111
<h1 class="wp-heading-inline"><?php esc_html_e( 'Advanced Settings', 'paid-memberships-pro' ); ?></h1>
112
<hr class="wp-header-end">
113
-
114
- <table class="form-table">
115
- <tbody>
116
- <tr>
117
- <th scope="row" valign="top">
118
- <label for="nonmembertext"><?php _e('Message for Logged-in Non-members', 'paid-memberships-pro' );?>:</label>
119
- </th>
120
- <td>
121
- <textarea name="nonmembertext" rows="3" cols="50" class="large-text"><?php echo stripslashes($nonmembertext)?></textarea>
122
- <p class="description"><?php _e('This message replaces the post content for non-members. Available variables', 'paid-memberships-pro' );?>: !!levels!!, !!referrer!!</p>
123
- </td>
124
- </tr>
125
- <tr>
126
- <th scope="row" valign="top">
127
- <label for="notloggedintext"><?php _e('Message for Logged-out Users', 'paid-memberships-pro' );?>:</label>
128
- </th>
129
- <td>
130
- <textarea name="notloggedintext" rows="3" cols="50" class="large-text"><?php echo stripslashes($notloggedintext)?></textarea>
131
- <p class="description"><?php _e('This message replaces the post content for logged-out visitors.', 'paid-memberships-pro' );?></p>
132
- </td>
133
- </tr>
134
- <tr>
135
- <th scope="row" valign="top">
136
- <label for="rsstext"><?php _e('Message for RSS Feed', 'paid-memberships-pro' );?>:</label>
137
- </th>
138
- <td>
139
- <textarea name="rsstext" rows="3" cols="50" class="large-text"><?php echo stripslashes($rsstext)?></textarea>
140
- <p class="description"><?php _e('This message replaces the post content in RSS feeds.', 'paid-memberships-pro' );?></p>
141
- </td>
142
- </tr>
143
- </tbody>
144
- </table>
145
<hr />
146
- <h2 class="title"><?php esc_html_e( 'Content Settings', 'paid-memberships-pro' ); ?></h2>
147
- <table class="form-table">
148
- <tbody>
149
- <tr>
150
- <th scope="row" valign="top">
151
- <label for="filterqueries"><?php _e("Filter searches and archives?", 'paid-memberships-pro' );?></label>
152
- </th>
153
- <td>
154
- <select id="filterqueries" name="filterqueries">
155
- <option value="0" <?php if(!$filterqueries) { ?>selected="selected"<?php } ?>><?php _e('No - Non-members will see restricted posts/pages in searches and archives.', 'paid-memberships-pro' );?></option>
156
- <option value="1" <?php if($filterqueries == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes - Only members will see restricted posts/pages in searches and archives.', 'paid-memberships-pro' );?></option>
157
- </select>
158
- </td>
159
- </tr>
160
- <tr>
161
- <th scope="row" valign="top">
162
- <label for="showexcerpts"><?php _e('Show Excerpts to Non-Members?', 'paid-memberships-pro' );?></label>
163
- </th>
164
- <td>
165
- <select id="showexcerpts" name="showexcerpts">
166
- <option value="0" <?php if(!$showexcerpts) { ?>selected="selected"<?php } ?>><?php _e('No - Hide excerpts.', 'paid-memberships-pro' );?></option>
167
- <option value="1" <?php if($showexcerpts == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes - Show excerpts.', 'paid-memberships-pro' );?></option>
168
- </select>
169
- </td>
170
- </tr>
171
- </tbody>
172
- </table>
173
<hr />
174
- <h2 class="title"><?php esc_html_e( 'reCAPTCHA Settings', 'paid-memberships-pro' ); ?></h2>
175
- <table class="form-table">
176
- <tbody>
177
- <tr>
178
- <th scope="row" valign="top">
179
- <label for="recaptcha"><?php _e('Use reCAPTCHA?', 'paid-memberships-pro' );?>:</label>
180
- </th>
181
- <td>
182
- <select id="recaptcha" name="recaptcha" onchange="pmpro_updateRecaptchaTRs();">
183
- <option value="0" <?php if(!$recaptcha) { ?>selected="selected"<?php } ?>><?php _e('No', 'paid-memberships-pro' );?></option>
184
- <option value="1" <?php if($recaptcha == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes - Free memberships only.', 'paid-memberships-pro' );?></option>
185
- <option value="2" <?php if($recaptcha == 2) { ?>selected="selected"<?php } ?>><?php _e('Yes - All memberships.', 'paid-memberships-pro' );?></option>
186
- </select>
187
- <p class="description"><?php _e('A free reCAPTCHA key is required.', 'paid-memberships-pro' );?> <a href="https://www.google.com/recaptcha/admin/create"><?php _e('Click here to signup for reCAPTCHA', 'paid-memberships-pro' );?></a>.</p>
188
- </td>
189
- </tr>
190
- </tbody>
191
- </table>
192
- <table class="form-table" id="recaptcha_settings" <?php if(!$recaptcha) { ?>style="display: none;"<?php } ?>>
193
- <tbody>
194
- <tr>
195
- <th scope="row" valign="top"><label for="recaptcha_version"><?php _e( 'reCAPTCHA Version', 'paid-memberships-pro' );?>:</label></th>
196
- <td>
197
- <select id="recaptcha_version" name="recaptcha_version">
198
- <option value="2_checkbox" <?php selected( '2_checkbox', $recaptcha_version ); ?>><?php _e( ' v2 - Checkbox', 'paid-memberships-pro' ); ?></option>
199
- <option value="3_invisible" <?php selected( '3_invisible', $recaptcha_version ); ?>><?php _e( 'v3 - Invisible', 'paid-memberships-pro' ); ?></option>
200
- </select>
201
- <p class="description"><?php _e( 'Changing your version will require new API keys.', 'paid-memberships-pro' ); ?></p>
202
- </td>
203
- </tr>
204
- <tr>
205
- <th scope="row"><label for="recaptcha_publickey"><?php _e('reCAPTCHA Site Key', 'paid-memberships-pro' );?>:</label></th>
206
- <td>
207
- <input type="text" id="recaptcha_publickey" name="recaptcha_publickey" value="<?php echo esc_attr($recaptcha_publickey);?>" class="regular-text code" />
208
- </td>
209
- </tr>
210
- <tr>
211
- <th scope="row"><label for="recaptcha_privatekey"><?php _e('reCAPTCHA Secret Key', 'paid-memberships-pro' );?>:</label></th>
212
- <td>
213
- <input type="text" id="recaptcha_privatekey" name="recaptcha_privatekey" value="<?php echo esc_attr($recaptcha_privatekey);?>" class="regular-text code" />
214
- </td>
215
- </tr>
216
- </tbody>
217
- </table>
218
<hr />
219
- <h2 clas="title"><?php esc_html_e( 'Other Settings', 'paid-memberships-pro' ); ?></h2>
220
- <table class="form-table">
221
- <tbody>
222
- <tr>
223
- <th scope="row" valign="top">
224
- <label for="hideads"><?php _e("Hide Ads From Members?", 'paid-memberships-pro' );?></label>
225
- </th>
226
- <td>
227
- <select id="hideads" name="hideads" onchange="pmpro_updateHideAdsTRs();">
228
- <option value="0" <?php if(!$hideads) { ?>selected="selected"<?php } ?>><?php _e('No', 'paid-memberships-pro' );?></option>
229
- <option value="1" <?php if($hideads == 1) { ?>selected="selected"<?php } ?>><?php _e('Hide Ads From All Members', 'paid-memberships-pro' );?></option>
230
- <option value="2" <?php if($hideads == 2) { ?>selected="selected"<?php } ?>><?php _e('Hide Ads From Certain Members', 'paid-memberships-pro' );?></option>
231
- </select>
232
- </td>
233
- </tr>
234
- <tr id="hideads_explanation" <?php if($hideads < 2) { ?>style="display: none;"<?php } ?>>
235
- <th scope="row" valign="top">&nbsp;</th>
236
- <td>
237
- <p><?php _e('Ads from the following plugins will be automatically turned off', 'paid-memberships-pro' );?>: <em>Easy Adsense</em>, ...</p>
238
- <p><?php _e('To hide ads in your template code, use code like the following', 'paid-memberships-pro' );?>:</p>
239
- <pre lang="PHP">
240
- if ( pmpro_displayAds() ) {
241
- //insert ad code here
242
- }</pre>
243
- </td>
244
- </tr>
245
- <tr>
246
- <th><?php _e( 'Notifications', 'paid-memberships-pro' ); ?></th>
247
- <td>
248
- <select name="maxnotificationpriority">
249
- <option value="5" <?php selected( $maxnotificationpriority, 5 ); ?>>
250
- <?php _e( 'Show all notifications.', 'paid-memberships-pro' ); ?>
251
- </option>
252
- <option value="1" <?php selected( $maxnotificationpriority, 1 ); ?>>
253
- <?php _e( 'Show only security notifications.', 'paid-memberships-pro' ); ?>
254
- </option>
255
- </select>
256
- <br />
257
- <p class="description"><?php _e('Notifications are occasionally shown on the Paid Memberships Pro settings pages.', 'paid-memberships-pro' );?></p>
258
- </td>
259
- </tr>
260
- <tr id="hideadslevels_tr" <?php if($hideads != 2) { ?>style="display: none;"<?php } ?>>
261
- <th scope="row" valign="top">
262
- <label for="hideadslevels"><?php _e('Choose Levels to Hide Ads From', 'paid-memberships-pro' );?>:</label>
263
- </th>
264
- <td>
265
- <div class="checkbox_box" <?php if(count($levels) > 5) { ?>style="height: 100px; overflow: auto;"<?php } ?>>
266
<?php
267
- $hideadslevels = pmpro_getOption("hideadslevels");
268
- if(!is_array($hideadslevels))
269
- $hideadslevels = explode(",", $hideadslevels);
270
-
271
- $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ";
272
- $levels = $wpdb->get_results($sqlQuery, OBJECT);
273
- foreach($levels as $level)
274
- {
275
?>
276
- <div class="clickable"><input type="checkbox" id="hideadslevels_<?php echo $level->id?>" name="hideadslevels[]" value="<?php echo $level->id?>" <?php if(in_array($level->id, $hideadslevels)) { ?>checked="checked"<?php } ?>> <?php echo $level->name?></div>
277
- <?php
278
- }
279
- ?>
280
- </div>
281
- <script>
282
- jQuery('.checkbox_box input').click(function(event) {
283
- event.stopPropagation()
284
- });
285
286
- jQuery('.checkbox_box div.clickable').click(function() {
287
- var checkbox = jQuery(this).find(':checkbox');
288
- checkbox.attr('checked', !checkbox.attr('checked'));
289
- });
290
- </script>
291
- </td>
292
- </tr>
293
- <?php if(is_multisite()) { ?>
294
- <tr>
295
- <th scope="row" valign="top">
296
- <label for="redirecttosubscription"><?php _e('Redirect all traffic from registration page to /susbcription/?', 'paid-memberships-pro' );?>: <em>(<?php _e('multisite only', 'paid-memberships-pro' );?>)</em></label>
297
- </th>
298
- <td>
299
- <select id="redirecttosubscription" name="redirecttosubscription">
300
- <option value="0" <?php if(!$redirecttosubscription) { ?>selected="selected"<?php } ?>><?php _e('No', 'paid-memberships-pro' );?></option>
301
- <option value="1" <?php if($redirecttosubscription == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes', 'paid-memberships-pro' );?></option>
302
- </select>
303
- </td>
304
- </tr>
305
- <?php } ?>
306
- <tr>
307
- <th scope="row" valign="top">
308
- <label for="tospage"><?php _e('Require Terms of Service on signups?', 'paid-memberships-pro' );?></label>
309
- </th>
310
- <td>
311
- <?php
312
- wp_dropdown_pages(array("name"=>"tospage", "show_option_none"=>"No", "selected"=>$tospage));
313
- ?>
314
- <br />
315
- <p class="description"><?php _e('If yes, create a WordPress page containing your TOS agreement and assign it using the dropdown above.', 'paid-memberships-pro' );?></p>
316
- </td>
317
- </tr>
318
319
- <?php
320
- // Filter to Add More Advanced Settings for Misc Plugin Options, etc.
321
- if (has_action('pmpro_custom_advanced_settings')) {
322
- $custom_fields = apply_filters('pmpro_custom_advanced_settings', array());
323
- foreach ($custom_fields as $field) {
324
- ?>
325
- <tr>
326
- <th valign="top" scope="row">
327
- <label
328
- for="<?php echo esc_attr( $field['field_name'] ); ?>"><?php echo esc_textarea( $field['label'] ); ?></label>
329
- </th>
330
- <td>
331
- <?php
332
- switch ($field['field_type']) {
333
- case 'select':
334
- ?>
335
- <select id="<?php echo esc_attr( $field['field_name'] ); ?>"
336
- name="<?php echo esc_attr( $field['field_name'] ); ?>">
337
- <?php
338
- //For associative arrays, we use the array keys as values. For numerically indexed arrays, we use the array values.
339
- $is_associative = (bool)count(array_filter(array_keys($field['options']), 'is_string'));
340
- foreach ($field['options'] as $key => $option) {
341
- if(!$is_associative) $key = $option;
342
- ?>
343
- <option value="<?php echo esc_attr($key); ?>" <?php selected($key, pmpro_getOption($field['field_name']));?>>
344
- <?php echo esc_textarea($option); ?>
345
- </option>
346
- <?php
347
- }
348
- ?>
349
- </select>
350
- <?php
351
- break;
352
- case 'text':
353
- ?>
354
- <input id="<?php echo esc_attr( $field['field_name'] ); ?>"
355
- name="<?php echo esc_attr( $field['field_name'] ); ?>"
356
- type="<?php echo esc_attr( $field['field_type'] ); ?>"
357
- value="<?php echo esc_attr(pmpro_getOption($field['field_name'])); ?> "
358
- class="regular-text">
359
- <?php
360
- break;
361
- case 'textarea':
362
- ?>
363
- <textarea id="<?php echo esc_attr( $field['field_name'] ); ?>"
364
- name="<?php echo esc_attr( $field['field_name'] ); ?>"
365
- class="large-text">
366
- <?php echo esc_textarea(pmpro_getOption($field['field_name'])); ?>
367
- </textarea>
368
- <?php
369
- break;
370
- default:
371
- break;
372
- }
373
- if (!empty($field['description'])) {
374
- ?>
375
- <p class="description"><?php echo esc_textarea( $field['description'] ); ?></p>
376
- <?php
377
- }
378
- ?>
379
- </td>
380
- </tr>
381
- <?php
382
- }
383
- }
384
- ?>
385
- </tbody>
386
- </table>
387
- <script>
388
- function pmpro_updateHideAdsTRs()
389
- {
390
- var hideads = jQuery('#hideads').val();
391
- if(hideads == 2)
392
{
393
- jQuery('#hideadslevels_tr').show();
394
- }
395
- else
396
- {
397
- jQuery('#hideadslevels_tr').hide();
398
- }
399
400
- if(hideads > 0)
401
- {
402
- jQuery('#hideads_explanation').show();
403
- }
404
- else
405
- {
406
- jQuery('#hideads_explanation').hide();
407
}
408
- }
409
- pmpro_updateHideAdsTRs();
410
411
- function pmpro_updateRecaptchaTRs()
412
- {
413
- var recaptcha = jQuery('#recaptcha').val();
414
- if(recaptcha > 0)
415
- {
416
- jQuery('#recaptcha_settings').show();
417
- }
418
- else
419
{
420
- jQuery('#recaptcha_settings').hide();
421
}
422
- }
423
- pmpro_updateRecaptchaTRs();
424
- </script>
425
426
<p class="submit">
427
<input name="savesettings" type="submit" class="button button-primary" value="<?php _e('Save Settings', 'paid-memberships-pro' );?>" />
17
//get/set settings
18
if(!empty($_REQUEST['savesettings']))
19
{
20
+ // Dashboard settings.
21
+ pmpro_setOption( 'hide_toolbar' );
22
+ pmpro_setOption( 'block_dashboard' );
23
+
24
+ // Message settings.
25
+ // These use wp_kses for better security handling.
26
$nonmembertext = wp_kses(wp_unslash($_POST['nonmembertext']), $allowedposttags);
27
update_option('pmpro_nonmembertext', $nonmembertext);
28
32
$rsstext = wp_kses(wp_unslash($_POST['rsstext']), $allowedposttags);
33
update_option('pmpro_rsstext', $rsstext);
34
35
+ // Content settings.
36
pmpro_setOption("filterqueries");
37
+ pmpro_setOption("showexcerpts");
38
39
+ // Checkout settings.
40
+ pmpro_setOption("tospage");
41
pmpro_setOption("recaptcha");
42
pmpro_setOption("recaptcha_version");
43
pmpro_setOption("recaptcha_publickey");
44
+ pmpro_setOption("recaptcha_privatekey");
45
46
+ // Communication settings.
47
+ pmpro_setOption("maxnotificationpriority");
48
+ pmpro_setOption("activity_email_frequency");
49
50
+ // Other settings.
51
+ pmpro_setOption("hideads");
52
+ pmpro_setOption("hideadslevels");
53
+ pmpro_setOption("redirecttosubscription");
54
55
/**
56
* Filter to add custom settings to the advanced settings page.
62
pmpro_setOption($setting['field_name']);
63
}
64
65
+ // Assume success.
66
$msg = true;
67
$msgt = __("Your advanced settings have been updated.", 'paid-memberships-pro' );
68
}
69
70
+ // Dashboard settings.
71
+ $hide_toolbar = pmpro_getOption( 'hide_toolbar' );
72
+ $block_dashboard = pmpro_getOption( 'block_dashboard' );
73
+
74
+ // Message settings.
75
$nonmembertext = pmpro_getOption("nonmembertext");
76
$notloggedintext = pmpro_getOption("notloggedintext");
77
$rsstext = pmpro_getOption("rsstext");
78
+
79
+ // Content settings.
80
+ $filterqueries = pmpro_getOption('filterqueries');
81
+ $showexcerpts = pmpro_getOption("showexcerpts");
82
83
+ // Checkout settings.
84
+ $tospage = pmpro_getOption("tospage");
85
$recaptcha = pmpro_getOption("recaptcha");
86
$recaptcha_version = pmpro_getOption("recaptcha_version");
87
$recaptcha_publickey = pmpro_getOption("recaptcha_publickey");
88
$recaptcha_privatekey = pmpro_getOption("recaptcha_privatekey");
89
90
+ // Communication settings.
91
+ $maxnotificationpriority = pmpro_getOption("maxnotificationpriority");
92
+ $activity_email_frequency = pmpro_getOption("activity_email_frequency");
93
94
+ // Other settings.
95
+ $hideads = pmpro_getOption("hideads");
96
+ $hideadslevels = pmpro_getOption("hideadslevels");
97
+ if( is_multisite() ) {
98
+ $redirecttosubscription = pmpro_getOption("redirecttosubscription");
99
+ }
100
101
+ // Default settings.
102
if(!$nonmembertext)
103
{
104
+ $nonmembertext = sprintf( __( 'This content is for !!levels!! members only.<br /><a href="%s">Join Now</a>', 'paid-memberships-pro' ), "!!levels_page_url!!" );
105
pmpro_setOption("nonmembertext", $nonmembertext);
106
}
107
if(!$notloggedintext)
108
{
109
+ $notloggedintext = sprintf( __( 'This content is for !!levels!! members only.<br /><a href="%s">Log In</a> <a href="%s">Join Now</a>', 'paid-memberships-pro' ), '!!login_url!!', "!!levels_page_url!!" );
110
pmpro_setOption("notloggedintext", $notloggedintext);
111
}
112
if(!$rsstext)
117
118
$levels = $wpdb->get_results( "SELECT * FROM {$wpdb->pmpro_membership_levels}", OBJECT );
119
120
+ if ( empty( $activity_email_frequency ) ) {
121
+ $activity_email_frequency = 'week';
122
+ }
123
+
124
require_once(dirname(__FILE__) . "/admin_header.php");
125
?>
126
129
130
<h1 class="wp-heading-inline"><?php esc_html_e( 'Advanced Settings', 'paid-memberships-pro' ); ?></h1>
131
<hr class="wp-header-end">
132
+ <div class="pmpro_admin_section pmpro_admin_section-restrict-dashboard">
133
+ <h2 class="title"><?php esc_html_e( 'Restrict Dashboard Access', 'paid-memberships-pro' ); ?></h2>
134
+ <table class="form-table">
135
+ <tbody>
136
+ <tr>
137
+ <th scope="row" valign="top">
138
+ <label for="block_dashboard"><?php _e('WordPress Dashboard', 'paid-memberships-pro' );?></label>
139
+ </th>
140
+ <td>
141
+ <input id="block_dashboard" name="block_dashboard" type="checkbox" value="yes" <?php checked( $block_dashboard, 'yes' ); ?> /> <label for="block_dashboard"><?php _e('Block all users with the Subscriber role from accessing the Dashboard.', 'paid-memberships-pro' );?></label>
142
+ </td>
143
+ </tr>
144
+ <tr>
145
+ <th scope="row" valign="top">
146
+ <label for="hide_toolbar"><?php _e('WordPress Toolbar', 'paid-memberships-pro' );?></label>
147
+ </th>
148
+ <td>
149
+ <input id="hide_toolbar" name="hide_toolbar" type="checkbox" value="yes" <?php checked( $hide_toolbar, 'yes' ); ?> /> <label for="hide_toolbar"><?php _e('Hide the Toolbar from all users with the Subscriber role.', 'paid-memberships-pro' );?></label>
150
+ </td>
151
+ </tr>
152
+ </tbody>
153
+ </table>
154
+ </div> <!-- end pmpro_admin_section-restrict-dashboard -->
155
<hr />
156
+ <div class="pmpro_admin_section pmpro_admin_section-message-settings">
157
+ <h2 class="title"><?php esc_html_e( 'Message Settings', 'paid-memberships-pro' ); ?></h2>
158
+ <table class="form-table">
159
+ <tbody>
160
+ <tr>
161
+ <th scope="row" valign="top">
162
+ <label for="nonmembertext"><?php _e('Message for Logged-in Non-members', 'paid-memberships-pro' );?>:</label>
163
+ </th>
164
+ <td>
165
+ <textarea name="nonmembertext" rows="3" cols="50" class="large-text"><?php echo stripslashes($nonmembertext)?></textarea>
166
+ <p class="description"><?php _e('This message replaces the post content for non-members. Available variables', 'paid-memberships-pro' );?>: <code>!!levels!!</code> <code>!!referrer!!</code> <code>!!levels_page_url!!</code></p>
167
+ </td>
168
+ </tr>
169
+ <tr>
170
+ <th scope="row" valign="top">
171
+ <label for="notloggedintext"><?php _e('Message for Logged-out Users', 'paid-memberships-pro' );?>:</label>
172
+ </th>
173
+ <td>
174
+ <textarea name="notloggedintext" rows="3" cols="50" class="large-text"><?php echo stripslashes($notloggedintext)?></textarea>
175
+ <p class="description"><?php _e('This message replaces the post content for logged-out visitors.', 'paid-memberships-pro' );?> <?php _e('Available variables', 'paid-memberships-pro' );?>: <code>!!levels!!</code> <code>!!referrer!!</code> <code>!!login_url!!</code> <code>!!levels_page_url!!</code></p>
176
+ </td>
177
+ </tr>
178
+ <tr>
179
+ <th scope="row" valign="top">
180
+ <label for="rsstext"><?php _e('Message for RSS Feed', 'paid-memberships-pro' );?>:</label>
181
+ </th>
182
+ <td>
183
+ <textarea name="rsstext" rows="3" cols="50" class="large-text"><?php echo stripslashes($rsstext)?></textarea>
184
+ <p class="description"><?php _e('This message replaces the post content in RSS feeds.', 'paid-memberships-pro' );?> <?php _e('Available variables', 'paid-memberships-pro' );?>: <code>!!levels!!</code></p>
185
+ </td>
186
+ </tr>
187
+ </tbody>
188
+ </table>
189
+ </div> <!-- end pmpro_admin_section-message-settings -->
190
<hr />
191
+ <div class="pmpro_admin_section pmpro_admin_section-content-settings">
192
+ <h2 class="title"><?php esc_html_e( 'Content Settings', 'paid-memberships-pro' ); ?></h2>
193
+ <table class="form-table">
194
+ <tbody>
195
+ <tr>
196
+ <th scope="row" valign="top">
197
+ <label for="filterqueries"><?php _e("Filter searches and archives?", 'paid-memberships-pro' );?></label>
198
+ </th>
199
+ <td>
200
+ <select id="filterqueries" name="filterqueries">
201
+ <option value="0" <?php if(!$filterqueries) { ?>selected="selected"<?php } ?>><?php _e('No - Non-members will see restricted posts/pages in searches and archives.', 'paid-memberships-pro' );?></option>
202
+ <option value="1" <?php if($filterqueries == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes - Only members will see restricted posts/pages in searches and archives.', 'paid-memberships-pro' );?></option>
203
+ </select>
204
+ </td>
205
+ </tr>
206
+ <tr>
207
+ <th scope="row" valign="top">
208
+ <label for="showexcerpts"><?php _e('Show Excerpts to Non-Members?', 'paid-memberships-pro' );?></label>
209
+ </th>
210
+ <td>
211
+ <select id="showexcerpts" name="showexcerpts">
212
+ <option value="0" <?php if(!$showexcerpts) { ?>selected="selected"<?php } ?>><?php _e('No - Hide excerpts.', 'paid-memberships-pro' );?></option>
213
+ <option value="1" <?php if($showexcerpts == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes - Show excerpts.', 'paid-memberships-pro' );?></option>
214
+ </select>
215
+ </td>
216
+ </tr>
217
+ </tbody>
218
+ </table>
219
+ </div> <!-- end pmpro_admin_section-content-settings -->
220
<hr />
221
+ <div class="pmpro_admin_section pmpro_admin_section-checkout-settings">
222
+ <h2 class="title"><?php esc_html_e( 'Checkout Settings', 'paid-memberships-pro' ); ?></h2>
223
+ <table class="form-table">
224
+ <tbody>
225
+ <tr>
226
+ <th scope="row" valign="top">
227
+ <label for="tospage"><?php _e('Require Terms of Service on signups?', 'paid-memberships-pro' );?></label>
228
+ </th>
229
+ <td>
230
<?php
231
+ wp_dropdown_pages(array("name"=>"tospage", "show_option_none"=>"No", "selected"=>$tospage));
232
?>
233
+ <br />
234
+ <p class="description"><?php _e('If yes, create a WordPress page containing your TOS agreement and assign it using the dropdown above.', 'paid-memberships-pro' );?></p>
235
+ </td>
236
+ </tr>
237
+ <tr>
238
+ <th scope="row" valign="top">
239
+ <label for="recaptcha"><?php _e('Use reCAPTCHA?', 'paid-memberships-pro' );?>:</label>
240
+ </th>
241
+ <td>
242
+ <select id="recaptcha" name="recaptcha" onchange="pmpro_updateRecaptchaTRs();">
243
+ <option value="0" <?php if(!$recaptcha) { ?>selected="selected"<?php } ?>><?php _e('No', 'paid-memberships-pro' );?></option>
244
+ <option value="1" <?php if($recaptcha == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes - Free memberships only.', 'paid-memberships-pro' );?></option>
245
+ <option value="2" <?php if($recaptcha == 2) { ?>selected="selected"<?php } ?>><?php _e('Yes - All memberships.', 'paid-memberships-pro' );?></option>
246
+ </select>
247
+ <p class="description"><?php _e('A free reCAPTCHA key is required.', 'paid-memberships-pro' );?> <a href="https://www.google.com/recaptcha/admin/create"><?php _e('Click here to signup for reCAPTCHA', 'paid-memberships-pro' );?></a>.</p>
248
+ </td>
249
+ </tr>
250
+ </tbody>
251
+ </table>
252
+ <table class="form-table" id="recaptcha_settings" <?php if(!$recaptcha) { ?>style="display: none;"<?php } ?>>
253
+ <tbody>
254
+ <tr>
255
+ <th scope="row" valign="top"><label for="recaptcha_version"><?php _e( 'reCAPTCHA Version', 'paid-memberships-pro' );?>:</label></th>
256
+ <td>
257
+ <select id="recaptcha_version" name="recaptcha_version">
258
+ <option value="2_checkbox" <?php selected( '2_checkbox', $recaptcha_version ); ?>><?php _e( ' v2 - Checkbox', 'paid-memberships-pro' ); ?></option>
259
+ <option value="3_invisible" <?php selected( '3_invisible', $recaptcha_version ); ?>><?php _e( 'v3 - Invisible', 'paid-memberships-pro' ); ?></option>
260
+ </select>
261
+ <p class="description"><?php _e( 'Changing your version will require new API keys.', 'paid-memberships-pro' ); ?></p>
262
+ </td>
263
+ </tr>
264
+ <tr>
265
+ <th scope="row"><label for="recaptcha_publickey"><?php _e('reCAPTCHA Site Key', 'paid-memberships-pro' );?>:</label></th>
266
+ <td>
267
+ <input type="text" id="recaptcha_publickey" name="recaptcha_publickey" value="<?php echo esc_attr($recaptcha_publickey);?>" class="regular-text code" />
268
+ </td>
269
+ </tr>
270
+ <tr>
271
+ <th scope="row"><label for="recaptcha_privatekey"><?php _e('reCAPTCHA Secret Key', 'paid-memberships-pro' );?>:</label></th>
272
+ <td>
273
+ <input type="text" id="recaptcha_privatekey" name="recaptcha_privatekey" value="<?php echo esc_attr($recaptcha_privatekey);?>" class="regular-text code" />
274
+ </td>
275
+ </tr>
276
+ </tbody>
277
+ </table>
278
+ </div> <!-- end pmpro_admin_section-checkout-settings -->
279
+ <hr />
280
+ <div class="pmpro_admin_section pmpro_admin_section-communication-settings">
281
+ <h2 class="title"><?php esc_html_e( 'Communication Settings', 'paid-memberships-pro' ); ?></h2>
282
+ <table class="form-table">
283
+ <tr>
284
+ <th><?php _e( 'Notifications', 'paid-memberships-pro' ); ?></th>
285
+ <td>
286
+ <select name="maxnotificationpriority">
287
+ <option value="5" <?php selected( $maxnotificationpriority, 5 ); ?>>
288
+ <?php _e( 'Show all notifications.', 'paid-memberships-pro' ); ?>
289
+ </option>
290
+ <option value="1" <?php selected( $maxnotificationpriority, 1 ); ?>>
291
+ <?php _e( 'Show only security notifications.', 'paid-memberships-pro' ); ?>
292
+ </option>
293
+ </select>
294
+ <br />
295
+ <p class="description"><?php _e('Notifications are occasionally shown on the Paid Memberships Pro settings pages.', 'paid-memberships-pro' );?></p>
296
+ </td>
297
+ </tr>
298
+ <tr>
299
+ <th>
300
+ <label for="activity_email_frequency"><?php _e('Activity Email Frequency', 'paid-memberships-pro' );?></label>
301
+ </th>
302
+ <td>
303
+ <select name="activity_email_frequency">
304
+ <option value="day" <?php selected( $activity_email_frequency, 'day' ); ?>>
305
+ <?php _e( 'Daily', 'paid-memberships-pro' ); ?>
306
+ </option>
307
+ <option value="week" <?php selected( $activity_email_frequency, 'week' ); ?>>
308
+ <?php _e( 'Weekly', 'paid-memberships-pro' ); ?>
309
+ </option>
310
+ <option value="month" <?php selected( $activity_email_frequency, 'month' ); ?>>
311
+ <?php _e( 'Monthly', 'paid-memberships-pro' ); ?>
312
+ </option>
313
+ <option value="never" <?php selected( $activity_email_frequency, 'never' ); ?>>
314
+ <?php _e( 'Never', 'paid-memberships-pro' ); ?>
315
+ </option>
316
+ </select>
317
+ <br />
318
+ <p class="description"><?php _e( 'Send periodic sales and revenue updates from this site to the administration email address.', 'paid-memberships-pro' );?></p>
319
+ </td>
320
+ </tr>
321
+ </tbody>
322
+ </table>
323
+ </div> <!-- end pmpro_admin_section-communication-settings -->
324
+ <hr />
325
+ <div class="pmpro_admin_section pmpro_admin_section-other-settings">
326
+ <h2 class="title"><?php esc_html_e( 'Other Settings', 'paid-memberships-pro' ); ?></h2>
327
+ <table class="form-table">
328
+ <tbody>
329
+ <tr>
330
+ <th scope="row" valign="top">
331
+ <label for="hideads"><?php _e("Hide Ads From Members?", 'paid-memberships-pro' );?></label>
332
+ </th>
333
+ <td>
334
+ <select id="hideads" name="hideads" onchange="pmpro_updateHideAdsTRs();">
335
+ <option value="0" <?php if(!$hideads) { ?>selected="selected"<?php } ?>><?php _e('No', 'paid-memberships-pro' );?></option>
336
+ <option value="1" <?php if($hideads == 1) { ?>selected="selected"<?php } ?>><?php _e('Hide Ads From All Members', 'paid-memberships-pro' );?></option>
337
+ <option value="2" <?php if($hideads == 2) { ?>selected="selected"<?php } ?>><?php _e('Hide Ads From Certain Members', 'paid-memberships-pro' );?></option>
338
+ </select>
339
+ </td>
340
+ </tr>
341
+ <tr id="hideads_explanation" <?php if($hideads < 2) { ?>style="display: none;"<?php } ?>>
342
+ <th scope="row" valign="top">&nbsp;</th>
343
+ <td>
344
+ <p><?php _e('Ads from the following plugins will be automatically turned off', 'paid-memberships-pro' );?>: <em>Easy Adsense</em>, ...</p>
345
+ <p><?php _e('To hide ads in your template code, use code like the following', 'paid-memberships-pro' );?>:</p>
346
+ <pre lang="PHP">
347
+ if ( pmpro_displayAds() ) {
348
+ //insert ad code here
349
+ }</pre>
350
+ </td>
351
+ </tr>
352
+ <tr id="hideadslevels_tr" <?php if($hideads != 2) { ?>style="display: none;"<?php } ?>>
353
+ <th scope="row" valign="top">
354
+ <label for="hideadslevels"><?php _e('Choose Levels to Hide Ads From', 'paid-memberships-pro' );?>:</label>
355
+ </th>
356
+ <td>
357
+ <div class="checkbox_box" <?php if(count($levels) > 5) { ?>style="height: 100px; overflow: auto;"<?php } ?>>
358
+ <?php
359
+ $hideadslevels = pmpro_getOption("hideadslevels");
360
+ if(!is_array($hideadslevels))
361
+ $hideadslevels = explode(",", $hideadslevels);
362
363
+ $sqlQuery = "SELECT * FROM $wpdb->pmpro_membership_levels ";
364
+ $levels = $wpdb->get_results($sqlQuery, OBJECT);
365
+ foreach($levels as $level)
366
+ {
367
+ ?>
368
+ <div class="clickable"><input type="checkbox" id="hideadslevels_<?php echo $level->id?>" name="hideadslevels[]" value="<?php echo $level->id?>" <?php if(in_array($level->id, $hideadslevels)) { ?>checked="checked"<?php } ?>> <?php echo $level->name?></div>
369
+ <?php
370
+ }
371
+ ?>
372
+ </div>
373
+ <script>
374
+ jQuery('.checkbox_box input').click(function(event) {
375
+ event.stopPropagation()
376
+ });
377
378
+ jQuery('.checkbox_box div.clickable').click(function() {
379
+ var checkbox = jQuery(this).find(':checkbox');
380
+ checkbox.attr('checked', !checkbox.attr('checked'));
381
+ });
382
+ </script>
383
+ </td>
384
+ </tr>
385
+ <?php if(is_multisite()) { ?>
386
+ <tr>
387
+ <th scope="row" valign="top">
388
+ <label for="redirecttosubscription"><?php _e('Redirect all traffic from registration page to /susbcription/?', 'paid-memberships-pro' );?>: <em>(<?php _e('multisite only', 'paid-memberships-pro' );?>)</em></label>
389
+ </th>
390
+ <td>
391
+ <select id="redirecttosubscription" name="redirecttosubscription">
392
+ <option value="0" <?php if(!$redirecttosubscription) { ?>selected="selected"<?php } ?>><?php _e('No', 'paid-memberships-pro' );?></option>
393
+ <option value="1" <?php if($redirecttosubscription == 1) { ?>selected="selected"<?php } ?>><?php _e('Yes', 'paid-memberships-pro' );?></option>
394
+ </select>
395
+ </td>
396
+ </tr>
397
+ <?php } ?>
398
+ <?php
399
+ // Filter to Add More Advanced Settings for Misc Plugin Options, etc.
400
+ if (has_action('pmpro_custom_advanced_settings')) {
401
+ $custom_fields = apply_filters('pmpro_custom_advanced_settings', array());
402
+ foreach ($custom_fields as $field) {
403
+ ?>
404
+ <tr>
405
+ <th valign="top" scope="row">
406
+ <label
407
+ for="<?php echo esc_attr( $field['field_name'] ); ?>"><?php echo esc_textarea( $field['label'] ); ?></label>
408
+ </th>
409
+ <td>
410
+ <?php
411
+ switch ($field['field_type']) {
412
+ case 'select':
413
+ ?>
414
+ <select id="<?php echo esc_attr( $field['field_name'] ); ?>"
415
+ name="<?php echo esc_attr( $field['field_name'] ); ?>">
416
+ <?php
417
+ //For associative arrays, we use the array keys as values. For numerically indexed arrays, we use the array values.
418
+ $is_associative = (bool)count(array_filter(array_keys($field['options']), 'is_string'));
419
+ foreach ($field['options'] as $key => $option) {
420
+ if(!$is_associative) $key = $option;
421
+ ?>
422
+ <option value="<?php echo esc_attr($key); ?>" <?php selected($key, pmpro_getOption($field['field_name']));?>>
423
+ <?php echo esc_textarea($option); ?>
424
+ </option>
425
+ <?php
426
+ }
427
+ ?>
428
+ </select>
429
+ <?php
430
+ break;
431
+ case 'text':
432
+ ?>
433
+ <input id="<?php echo esc_attr( $field['field_name'] ); ?>"
434
+ name="<?php echo esc_attr( $field['field_name'] ); ?>"
435
+ type="<?php echo esc_attr( $field['field_type'] ); ?>"
436
+ value="<?php echo esc_attr(pmpro_getOption($field['field_name'])); ?> "
437
+ class="regular-text">
438
+ <?php
439
+ break;
440
+ case 'textarea':
441
+ ?>
442
+ <textarea id="<?php echo esc_attr( $field['field_name'] ); ?>"
443
+ name="<?php echo esc_attr( $field['field_name'] ); ?>"
444
+ class="large-text">
445
+ <?php echo esc_textarea(pmpro_getOption($field['field_name'])); ?>
446
+ </textarea>
447
+ <?php
448
+ break;
449
+ default:
450
+ break;
451
+ }
452
+ if (!empty($field['description'])) {
453
+ ?>
454
+ <p class="description"><?php echo esc_textarea( $field['description'] ); ?></p>
455
+ <?php
456
+ }
457
+ ?>
458
+ </td>
459
+ </tr>
460
+ <?php
461
+ }
462
+ }
463
+ ?>
464
+ </tbody>
465
+ </table>
466
+ <script>
467
+ function pmpro_updateHideAdsTRs()
468
{
469
+ var hideads = jQuery('#hideads').val();
470
+ if(hideads == 2)
471
+ {
472
+ jQuery('#hideadslevels_tr').show();
473
+ }
474
+ else
475
+ {
476
+ jQuery('#hideadslevels_tr').hide();
477
+ }
478
479
+ if(hideads > 0)
480
+ {
481
+ jQuery('#hideads_explanation').show();
482
+ }
483
+ else
484
+ {
485
+ jQuery('#hideads_explanation').hide();
486
+ }
487
}
488
+ pmpro_updateHideAdsTRs();
489
490
+ function pmpro_updateRecaptchaTRs()
491
{
492
+ var recaptcha = jQuery('#recaptcha').val();
493
+ if(recaptcha > 0)
494
+ {
495
+ jQuery('#recaptcha_settings').show();
496
+ }
497
+ else
498
+ {
499
+ jQuery('#recaptcha_settings').hide();
500
+ }
501
}
502
+ pmpro_updateRecaptchaTRs();
503
+ </script>
504
+ </div> <!-- end pmpro_admin_section-other-settings -->
505
506
<p class="submit">
507
<input name="savesettings" type="submit" class="button button-primary" value="<?php _e('Save Settings', 'paid-memberships-pro' );?>" />
adminpages/dashboard.php CHANGED
@@ -172,7 +172,7 @@ function pmpro_dashboard_welcome_callback() { ?>
172
<?php } elseif ( ! pmpro_license_isValid() ) { ?>
173
<p class="pmpro_message pmpro_alert">
174
<strong><?php echo esc_html_e( 'Your license is invalid or expired.', 'paid-memberships-pro' ); ?></strong><br />
175
- <?php printf(__( '<a href="%s">View your membership account</a> to verify your license key.', 'paid-memberships-pro' ), 'https://www.paidmembershipspro.com/login/?redirect_to=%2Fmembership-account%2F%3Futm_source%3Dplugin%26utm_medium%3Dpmpro-dashboard%26utm_campaign%3Dmembership-account%26utm_content%3Dverify-license-key' );?>
176
<?php } else { ?>
177
<p class="pmpro_message pmpro_success"><?php printf(__( '<strong>Thank you!</strong> A valid <strong>%s</strong> license key has been used to activate your support license on this site.', 'paid-memberships-pro' ), ucwords($pmpro_license_check['license']));?></p>
178
<?php } ?>
@@ -318,10 +318,16 @@ function pmpro_dashboard_report_recent_orders_callback() {
318
<?php } ?>
319
</td>
320
<td>
321
- <?php
322
- $level = pmpro_getLevel( $order->membership_id );
323
- echo $level->name;
324
- ?>
325
</td>
326
<td><?php echo pmpro_formatPrice( $order->total ); ?></td>
327
<td>
172
<?php } elseif ( ! pmpro_license_isValid() ) { ?>
173
<p class="pmpro_message pmpro_alert">
174
<strong><?php echo esc_html_e( 'Your license is invalid or expired.', 'paid-memberships-pro' ); ?></strong><br />
175
+ <?php printf(__( '<a href="%s">View your membership account</a> to verify your license key.', 'paid-memberships-pro' ), 'https://www.paidmembershipspro.com/membership-account/?redirect_to=%2Fmembership-account%2F%3Futm_source%3Dplugin%26utm_medium%3Dpmpro-dashboard%26utm_campaign%3Dmembership-account%26utm_content%3Dverify-license-key' );?>
176
<?php } else { ?>
177
<p class="pmpro_message pmpro_success"><?php printf(__( '<strong>Thank you!</strong> A valid <strong>%s</strong> license key has been used to activate your support license on this site.', 'paid-memberships-pro' ), ucwords($pmpro_license_check['license']));?></p>
178
<?php } ?>
318
<?php } ?>
319
</td>
320
<td>
321
+ <?php
322
+ $level = pmpro_getLevel( $order->membership_id );
323
+ if ( ! empty( $level ) ) {
324
+ echo $level->name;
325
+ } elseif ( $order->membership_id > 0 ) { ?>
326
+ [<?php _e( 'deleted', 'paid-memberships-pro' ); ?>]
327
+ <?php } else { ?>
328
+ [<?php _e( 'none', 'paid-memberships-pro' ); ?>]
329
+ <?php }
330
+ ?>
331
</td>
332
<td><?php echo pmpro_formatPrice( $order->total ); ?></td>
333
<td>
adminpages/discountcodes.php CHANGED
@@ -8,6 +8,8 @@
8
//vars
9
global $wpdb, $pmpro_currency_symbol;
10
11
if(isset($_REQUEST['edit']))
12
$edit = intval($_REQUEST['edit']);
13
else
@@ -76,8 +78,8 @@
76
$uses = intval($_POST['uses']);
77
78
//fix up dates
79
- $starts = date_i18n("Y-m-d", strtotime($starts_month . "/" . $starts_day . "/" . $starts_year, current_time("timestamp")));
80
- $expires = date_i18n("Y-m-d", strtotime($expires_month . "/" . $expires_day . "/" . $expires_year, current_time("timestamp")));
81
82
//insert/update/replace discount code
83
$wpdb->replace(
@@ -450,33 +452,33 @@
450
451
<?php
452
//some vars for the dates
453
- $current_day = date_i18n("j");
454
if(!empty($code->starts))
455
- $selected_starts_day = date_i18n("j", $code->starts);
456
else
457
$selected_starts_day = $current_day;
458
if(!empty($code->expires))
459
- $selected_expires_day = date_i18n("j", $code->expires);
460
else
461
$selected_expires_day = $current_day;
462
463
- $current_month = date_i18n("M");
464
if(!empty($code->starts))
465
- $selected_starts_month = date_i18n("m", $code->starts);
466
else
467
- $selected_starts_month = date_i18n("m");
468
if(!empty($code->expires))
469
- $selected_expires_month = date_i18n("m", $code->expires);
470
else
471
- $selected_expires_month = date_i18n("m");
472
473
- $current_year = date_i18n("Y");
474
if(!empty($code->starts))
475
- $selected_starts_year = date_i18n("Y", $code->starts);
476
else
477
$selected_starts_year = $current_year;
478
if(!empty($code->expires))
479
- $selected_expires_year = date_i18n("Y", $code->expires);
480
else
481
$selected_expires_year = (int)$current_year + 1;
482
?>
@@ -489,7 +491,7 @@
489
for($i = 1; $i < 13; $i++)
490
{
491
?>
492
- <option value="<?php echo $i?>" <?php if($i == $selected_starts_month) { ?>selected="selected"<?php } ?>><?php echo date_i18n("M", strtotime($i . "/15/" . $current_year, current_time("timestamp")))?></option>
493
<?php
494
}
495
?>
@@ -507,7 +509,7 @@
507
for($i = 1; $i < 13; $i++)
508
{
509
?>
510
- <option value="<?php echo $i?>" <?php if($i == $selected_expires_month) { ?>selected="selected"<?php } ?>><?php echo date_i18n("M", strtotime($i . "/15/" . $current_year, current_time("timestamp")))?></option>
511
<?php
512
}
513
?>
8
//vars
9
global $wpdb, $pmpro_currency_symbol;
10
11
+ $now = current_time( 'timestamp' );
12
+
13
if(isset($_REQUEST['edit']))
14
$edit = intval($_REQUEST['edit']);
15
else
78
$uses = intval($_POST['uses']);
79
80
//fix up dates
81
+ $starts = date("Y-m-d", strtotime($starts_month . "/" . $starts_day . "/" . $starts_year, $now ));
82
+ $expires = date("Y-m-d", strtotime($expires_month . "/" . $expires_day . "/" . $expires_year, $now ));
83
84
//insert/update/replace discount code
85
$wpdb->replace(
452
453
<?php
454
//some vars for the dates
455
+ $current_day = date("j");
456
if(!empty($code->starts))
457
+ $selected_starts_day = date("j", $code->starts);
458
else
459
$selected_starts_day = $current_day;
460
if(!empty($code->expires))
461
+ $selected_expires_day = date("j", $code->expires);
462
else
463
$selected_expires_day = $current_day;
464
465
+ $current_month = date("M");
466
if(!empty($code->starts))
467
+ $selected_starts_month = date("m", $code->starts);
468
else
469
+ $selected_starts_month = date("m");
470
if(!empty($code->expires))
471
+ $selected_expires_month = date("m", $code->expires);
472
else
473
+ $selected_expires_month = date("m");
474
475
+ $current_year = date("Y");
476
if(!empty($code->starts))
477
+ $selected_starts_year = date("Y", $code->starts);
478
else
479
$selected_starts_year = $current_year;
480
if(!empty($code->expires))
481
+ $selected_expires_year = date("Y", $code->expires);
482
else
483
$selected_expires_year = (int)$current_year + 1;
484
?>
491
for($i = 1; $i < 13; $i++)
492
{
493
?>
494
+ <option value="<?php echo esc_attr( $i )?>" <?php if($i == $selected_starts_month) { ?>selected="selected"<?php } ?>><?php echo esc_html( date_i18n( 'F', mktime( 0, 0, 0, $i, 2 ) ) ); ?></option>
495
<?php
496
}
497
?>
509
for($i = 1; $i < 13; $i++)
510
{
511
?>
512
+ <option value="<?php echo esc_attr( $i );?>" <?php if($i == $selected_expires_month) { ?>selected="selected"<?php } ?>><?php echo esc_html( date_i18n( 'F', mktime( 0, 0, 0, $i, 2 ) ) ); ?></option>
513
<?php
514
}
515
?>
adminpages/license.php CHANGED
@@ -44,9 +44,9 @@ if ( defined( 'PMPRO_DIR' ) ) {
44
45
<div class="about-text">
46
<?php if(!pmpro_license_isValid() && empty($key)) { ?>
47
- <p class="pmpro_message pmpro_error"><strong><?php _e('Enter your support license key.</strong> Your license key can be found in your membership email receipt or in your <a href="https://www.paidmembershipspro.com/login/?redirect_to=%2Fmembership-account%2F%3Futm_source%3Dplugin%26utm_medium%3Dpmpro-license%26utm_campaign%3Dmembership-account%26utm_content%3Dno-key" target="_blank">Membership Account</a>.', 'paid-memberships-pro' );?></p>
48
<?php } elseif(!pmpro_license_isValid()) { ?>
49
- <p class="pmpro_message pmpro_error"><strong><?php _e('Your license is invalid or expired.', 'paid-memberships-pro' );?></strong> <?php _e('Visit the PMPro <a href="https://www.paidmembershipspro.com/login/?redirect_to=%2Fmembership-account%2F%3Futm_source%3Dplugin%26utm_medium%3Dpmpro-license%26utm_campaign%3Dmembership-account%26utm_content%3Dkey-not-valid" target="_blank">Membership Account</a> page to confirm that your account is active and to find your license key.', 'paid-memberships-pro' );?></p>
50
<?php } else { ?>
51
<p class="pmpro_message pmpro_success"><?php printf(__('<strong>Thank you!</strong> A valid <strong>%s</strong> license key has been used to activate your support license on this site.', 'paid-memberships-pro' ), ucwords($pmpro_license_check['license']));?></p>
52
<?php } ?>
@@ -70,8 +70,8 @@ if ( defined( 'PMPRO_DIR' ) ) {
70
<a class="button button-primary button-hero" href="https://www.paidmembershipspro.com/membership-checkout/?level=20&utm_source=plugin&utm_medium=pmpro-license&utm_campaign=plus-checkout&utm_content=buy-plus" target="_blank"><?php echo esc_html( 'Buy Plus License', 'paid-memberships-pro' ); ?></a>
71
<a class="button button-hero" href="https://www.paidmembershipspro.com/pricing/?utm_source=plugin&utm_medium=pmpro-license&utm_campaign=pricing&utm_content=view-license-options" target="_blank"><?php echo esc_html( 'View Support License Options', 'paid-memberships-pro' ); ?></a>
72
<?php } else { ?>
73
- <a class="button button-primary button-hero" href="https://www.paidmembershipspro.com/login/?redirect_to=%2Fmembership-account%2F%3Futm_source%3Dplugin%26utm_medium%3Dpmpro-license%26utm_campaign%3Dmembership-account%26utm_content%3Dview-account" target="_blank"><?php echo esc_html( 'Manage My Account', 'paid-memberships-pro' ); ?></a>
74
- <a class="button button-hero" href="https://www.paidmembershipspro.com/login/?redirect_to=%2Fnew-topic%2F%3Futm_source%3Dplugin%26utm_medium%3Dpmpro-license%26utm_campaign%3Dsupport%26utm_content%3Dnew-support-ticket" target="_blank"><?php echo esc_html( 'Open Support Ticket', 'paid-memberships-pro' ); ?></a>
75
<?php } ?>
76
</p>
77
44
45
<div class="about-text">
46
<?php if(!pmpro_license_isValid() && empty($key)) { ?>
47
+ <p class="pmpro_message pmpro_error"><strong><?php _e('Enter your support license key.</strong> Your license key can be found in your membership email receipt or in your <a href="https://www.paidmembershipspro.com/membership-account/?redirect_to=%2Fmembership-account%2F%3Futm_source%3Dplugin%26utm_medium%3Dpmpro-license%26utm_campaign%3Dmembership-account%26utm_content%3Dno-key" target="_blank">Membership Account</a>.', 'paid-memberships-pro' );?></p>
48
<?php } elseif(!pmpro_license_isValid()) { ?>
49
+ <p class="pmpro_message pmpro_error"><strong><?php _e('Your license is invalid or expired.', 'paid-memberships-pro' );?></strong> <?php _e('Visit the PMPro <a href="https://www.paidmembershipspro.com/membership-account/?redirect_to=%2Fmembership-account%2F%3Futm_source%3Dplugin%26utm_medium%3Dpmpro-license%26utm_campaign%3Dmembership-account%26utm_content%3Dkey-not-valid" target="_blank">Membership Account</a> page to confirm that your account is active and to find your license key.', 'paid-memberships-pro' );?></p>
50
<?php } else { ?>
51
<p class="pmpro_message pmpro_success"><?php printf(__('<strong>Thank you!</strong> A valid <strong>%s</strong> license key has been used to activate your support license on this site.', 'paid-memberships-pro' ), ucwords($pmpro_license_check['license']));?></p>
52
<?php } ?>
70
<a class="button button-primary button-hero" href="https://www.paidmembershipspro.com/membership-checkout/?level=20&utm_source=plugin&utm_medium=pmpro-license&utm_campaign=plus-checkout&utm_content=buy-plus" target="_blank"><?php echo esc_html( 'Buy Plus License', 'paid-memberships-pro' ); ?></a>
71
<a class="button button-hero" href="https://www.paidmembershipspro.com/pricing/?utm_source=plugin&utm_medium=pmpro-license&utm_campaign=pricing&utm_content=view-license-options" target="_blank"><?php echo esc_html( 'View Support License Options', 'paid-memberships-pro' ); ?></a>
72
<?php } else { ?>
73
+ <a class="button button-primary button-hero" href="https://www.paidmembershipspro.com/membership-account/?redirect_to=%2Fmembership-account%2F%3Futm_source%3Dplugin%26utm_medium%3Dpmpro-license%26utm_campaign%3Dmembership-account%26utm_content%3Dview-account" target="_blank"><?php echo esc_html( 'Manage My Account', 'paid-memberships-pro' ); ?></a>
74
+ <a class="button button-hero" href="https://www.paidmembershipspro.com/membership-account/?redirect_to=%2Fnew-topic%2F%3Futm_source%3Dplugin%26utm_medium%3Dpmpro-license%26utm_campaign%3Dsupport%26utm_content%3Dnew-support-ticket" target="_blank"><?php echo esc_html( 'Open Support Ticket', 'paid-memberships-pro' ); ?></a>
75
<?php } ?>
76
</p>
77
adminpages/orders.php CHANGED
@@ -6,6 +6,9 @@ if ( ! function_exists( 'current_user_can' ) || ( ! current_user_can( 'manage_op
6
7
// vars
8
global $wpdb;
9
if ( isset( $_REQUEST['s'] ) ) {
10
$s = sanitize_text_field( trim( $_REQUEST['s'] ) );
11
} else {
@@ -39,25 +42,25 @@ if ( isset( $_REQUEST['start-day'] ) ) {
39
if ( isset( $_REQUEST['start-year'] ) ) {
40
$start_year = intval( $_REQUEST['start-year'] );
41
} else {
42
- $start_year = date_i18n( 'Y' );
43
}
44
45
if ( isset( $_REQUEST['end-month'] ) ) {
46
$end_month = intval( $_REQUEST['end-month'] );
47
} else {
48
- $end_month = date_i18n( 'n' );
49
}
50
51
if ( isset( $_REQUEST['end-day'] ) ) {
52
$end_day = intval( $_REQUEST['end-day'] );
53
} else {
54
- $end_day = date_i18n( 'j' );
55
}
56
57
if ( isset( $_REQUEST['end-year'] ) ) {
58
$end_year = intval( $_REQUEST['end-year'] );
59
} else {
60
- $end_year = date_i18n( 'Y' );
61
}
62
63
if ( isset( $_REQUEST['predefined-date'] ) ) {
@@ -117,19 +120,19 @@ if ( empty( $filter ) || $filter === 'all' ) {
117
$condition = "o.timestamp BETWEEN '" . esc_sql( $start_date ) . "' AND '" . esc_sql( $end_date ) . "'";
118
} elseif ( $filter == 'predefined-date-range' ) {
119
if ( $predefined_date == 'Last Month' ) {
120
- $start_date = date_i18n( 'Y-m-d', strtotime( 'first day of last month', current_time( 'timestamp' ) ) );
121
- $end_date = date_i18n( 'Y-m-d', strtotime( 'last day of last month', current_time( 'timestamp' ) ) );
122
} elseif ( $predefined_date == 'This Month' ) {
123
- $start_date = date_i18n( 'Y-m-d', strtotime( 'first day of this month', current_time( 'timestamp' ) ) );
124
- $end_date = date_i18n( 'Y-m-d', strtotime( 'last day of this month', current_time( 'timestamp' ) ) );
125
} elseif ( $predefined_date == 'This Year' ) {
126
- $year = date_i18n( 'Y' );
127
- $start_date = date_i18n( 'Y-m-d', strtotime( "first day of January $year", current_time( 'timestamp' ) ) );
128
- $end_date = date_i18n( 'Y-m-d', strtotime( "last day of December $year", current_time( 'timestamp' ) ) );
129
} elseif ( $predefined_date == 'Last Year' ) {
130
- $year = date_i18n( 'Y' ) - 1;
131
- $start_date = date_i18n( 'Y-m-d', strtotime( "first day of January $year", current_time( 'timestamp' ) ) );
132
- $end_date = date_i18n( 'Y-m-d', strtotime( "last day of December $year", current_time( 'timestamp' ) ) );
133
}
134
135
// add times to dates
@@ -149,6 +152,8 @@ if ( empty( $filter ) || $filter === 'all' ) {
149
$condition = "o.total = 0";
150
}
151
152
// deleting?
153
if ( ! empty( $_REQUEST['delete'] ) ) {
154
$dorder = new MemberOrder( intval( $_REQUEST['delete'] ) );
@@ -161,7 +166,7 @@ if ( ! empty( $_REQUEST['delete'] ) ) {
161
}
162
}
163
164
- $thisyear = date_i18n( 'Y' );
165
166
// this array stores fields that should be read only
167
$read_only_fields = apply_filters(
@@ -292,7 +297,7 @@ if ( ! empty( $_REQUEST['save'] ) ) {
292
}
293
294
// handle timestamp
295
- if ( $order->updateTimestamp( intval( $_POST['ts_year'] ), intval( $_POST['ts_month'] ), intval( $_POST['ts_day'] ) ) !== false ) {
296
$pmpro_msg = __( 'Order saved successfully.', 'paid-memberships-pro' );
297
$pmpro_msgt = 'success';
298
} else {
@@ -817,25 +822,30 @@ selected="selected"<?php } ?>><?php _e( 'Live/Production', 'paid-memberships-pro
817
} else {
818
$timestamp = current_time( 'timestamp' );
819
}
820
- $year = date_i18n( 'Y', $timestamp );
821
- $month = date_i18n( 'n', $timestamp );
822
- $day = date_i18n( 'j', $timestamp );
823
?>
824
<select id="ts_month" name="ts_month">
825
<?php
826
for ( $i = 1; $i < 13; $i ++ ) {
827
- ?>
828
- <option value="<?php echo $i; ?>"
829
- <?php
830
- if ( $i == $month ) {
831
- ?>
832
- selected="selected"<?php } ?>><?php echo date_i18n( 'M', strtotime( $i . '/15/' . $year, current_time( 'timestamp' ) ) ); ?></option>
833
- <?php
834
}
835
?>
836
</select>
837
<input name="ts_day" type="text" size="2" value="<?php echo esc_attr( $day ); ?>"/>
838
<input name="ts_year" type="text" size="4" value="<?php echo esc_attr( $year ); ?>"/>
839
<?php } ?>
840
</td>
841
</tr>
@@ -996,6 +1006,11 @@ selected="selected"<?php } ?>><?php echo date_i18n( 'M', strtotime( $i . '/15/'
996
value="only-paid" <?php selected( $filter, 'only-paid' ); ?>><?php _e( 'Only Paid Orders', 'paid-memberships-pro' ); ?></option>
997
<option
998
value="only-free" <?php selected( $filter, 'only-free' ); ?>><?php _e( 'Only Free Orders', 'paid-memberships-pro' ); ?></option>
999
</select>
1000
1001
<span id="from"><?php _e( 'From', 'paid-memberships-pro' ); ?></span>
@@ -1003,7 +1018,7 @@ selected="selected"<?php } ?>><?php echo date_i18n( 'M', strtotime( $i . '/15/'
1003
<select id="start-month" name="start-month">
1004
<?php for ( $i = 1; $i < 13; $i ++ ) { ?>
1005
<option
1006
- value="<?php echo $i; ?>" <?php selected( $start_month, $i ); ?>><?php echo date_i18n( 'F', mktime( 0, 0, 0, $i, 2 ) ); ?></option>
1007
<?php } ?>
1008
</select>
1009
@@ -1018,7 +1033,7 @@ selected="selected"<?php } ?>><?php echo date_i18n( 'M', strtotime( $i . '/15/'
1018
<select id="end-month" name="end-month">
1019
<?php for ( $i = 1; $i < 13; $i ++ ) { ?>
1020
<option
1021
- value="<?php echo $i; ?>" <?php selected( $end_month, $i ); ?>><?php echo date_i18n( 'F', mktime( 0, 0, 0, $i, 2 ) ); ?></option>
1022
<?php } ?>
1023
</select>
1024
@@ -1375,7 +1390,13 @@ class="alternate"<?php } ?>>
1375
<td>
1376
<?php
1377
$level = pmpro_getLevel( $order->membership_id );
1378
- echo $level->name;
1379
?>
1380
</td>
1381
<td><?php echo pmpro_formatPrice( $order->total ); ?></td>
6
7
// vars
8
global $wpdb;
9
+
10
+ $now = current_time( 'timestamp' );
11
+
12
if ( isset( $_REQUEST['s'] ) ) {
13
$s = sanitize_text_field( trim( $_REQUEST['s'] ) );
14
} else {
42
if ( isset( $_REQUEST['start-year'] ) ) {
43
$start_year = intval( $_REQUEST['start-year'] );
44
} else {
45
+ $start_year = date( 'Y', $now );
46
}
47
48
if ( isset( $_REQUEST['end-month'] ) ) {
49
$end_month = intval( $_REQUEST['end-month'] );
50
} else {
51
+ $end_month = date( 'n', $now );
52
}
53
54
if ( isset( $_REQUEST['end-day'] ) ) {
55
$end_day = intval( $_REQUEST['end-day'] );
56
} else {
57
+ $end_day = date( 'j', $now );
58
}
59
60
if ( isset( $_REQUEST['end-year'] ) ) {
61
$end_year = intval( $_REQUEST['end-year'] );
62
} else {
63
+ $end_year = date( 'Y', $now );
64
}
65
66
if ( isset( $_REQUEST['predefined-date'] ) ) {
120
$condition = "o.timestamp BETWEEN '" . esc_sql( $start_date ) . "' AND '" . esc_sql( $end_date ) . "'";
121
} elseif ( $filter == 'predefined-date-range' ) {
122
if ( $predefined_date == 'Last Month' ) {
123
+ $start_date = date( 'Y-m-d', strtotime( 'first day of last month', $now ) );
124
+ $end_date = date( 'Y-m-d', strtotime( 'last day of last month', $now ) );
125
} elseif ( $predefined_date == 'This Month' ) {
126
+ $start_date = date( 'Y-m-d', strtotime( 'first day of this month', $now ) );
127
+ $end_date = date( 'Y-m-d', strtotime( 'last day of this month', $now ) );
128
} elseif ( $predefined_date == 'This Year' ) {
129
+ $year = date( 'Y', $now );
130
+ $start_date = date( 'Y-m-d', strtotime( "first day of January $year", $now ) );
131
+ $end_date = date( 'Y-m-d', strtotime( "last day of December $year", $now ) );
132
} elseif ( $predefined_date == 'Last Year' ) {
133
+ $year = date( 'Y', $now ) - 1;
134
+ $start_date = date( 'Y-m-d', strtotime( "first day of January $year", $now ) );
135
+ $end_date = date( 'Y-m-d', strtotime( "last day of December $year", $now ) );
136
}
137
138
// add times to dates
152
$condition = "o.total = 0";
153
}
154
155
+ $condition = apply_filters( 'pmpro_admin_orders_query_condition', $condition, $filter );
156
+
157
// deleting?
158
if ( ! empty( $_REQUEST['delete'] ) ) {
159
$dorder = new MemberOrder( intval( $_REQUEST['delete'] ) );
166
}
167
}
168
169
+ $thisyear = date( 'Y', $now );
170
171
// this array stores fields that should be read only
172
$read_only_fields = apply_filters(
297
}
298
299
// handle timestamp
300
+ if ( $order->updateTimestamp( intval( $_POST['ts_year'] ), intval( $_POST['ts_month'] ), intval( $_POST['ts_day'] ), intval( $_POST['ts_hour'] ) . ':' . intval( $_POST['ts_minute'] ) . ':00' ) !== false ) {
301
$pmpro_msg = __( 'Order saved successfully.', 'paid-memberships-pro' );
302
$pmpro_msgt = 'success';
303
} else {
822
} else {
823
$timestamp = current_time( 'timestamp' );
824
}
825
+
826
+ $year = date( 'Y', $timestamp );
827
+ $month = date( 'n', $timestamp );
828
+ $day = date( 'j', $timestamp );
829
+ $hour = date( 'H', $timestamp );
830
+ $minute = date( 'i', $timestamp );
831
+ $second = date( 's', $timestamp );
832
?>
833
<select id="ts_month" name="ts_month">
834
<?php
835
for ( $i = 1; $i < 13; $i ++ ) {
836
+ ?>
837
+ <option value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, $month ); ?>>
838
+ <?php echo esc_html( date_i18n( 'F', mktime( 0, 0, 0, $i, 2 ) ) ); ?>
839
+ </option>
840
+ <?php
841
}
842
?>
843
</select>
844
<input name="ts_day" type="text" size="2" value="<?php echo esc_attr( $day ); ?>"/>
845
<input name="ts_year" type="text" size="4" value="<?php echo esc_attr( $year ); ?>"/>
846
+ <?php esc_html_e( 'at', 'paid-memberships-pro' ); ?>
847
+ <input name="ts_hour" type="text" size="2" value="<?php echo esc_attr( $hour ); ?>"/> :
848
+ <input name="ts_minute" type="text" size="2" value="<?php echo esc_attr( $minute ); ?>"/>
849
<?php } ?>
850
</td>
851
</tr>
1006
value="only-paid" <?php selected( $filter, 'only-paid' ); ?>><?php _e( 'Only Paid Orders', 'paid-memberships-pro' ); ?></option>
1007
<option
1008
value="only-free" <?php selected( $filter, 'only-free' ); ?>><?php _e( 'Only Free Orders', 'paid-memberships-pro' ); ?></option>
1009
+
1010
+ <?php $custom_filters = apply_filters( 'pmpro_admin_orders_filters', array() ); ?>
1011
+ <?php foreach( $custom_filters as $value => $name ) { ?>
1012
+ <option value="<?php esc_attr_e( $value ); ?>" <?php selected( $filter, $value ); ?>><?php esc_html_e( $name ); ?></option>
1013
+ <?php } ?>
1014
</select>
1015
1016
<span id="from"><?php _e( 'From', 'paid-memberships-pro' ); ?></span>
1018
<select id="start-month" name="start-month">
1019
<?php for ( $i = 1; $i < 13; $i ++ ) { ?>
1020
<option
1021
+ value="<?php echo esc_attr( $i ); ?>" <?php selected( $start_month, $i ); ?>><?php echo esc_html( date_i18n( 'F', mktime( 0, 0, 0, $i, 2 ) ) ); ?></option>
1022
<?php } ?>
1023
</select>
1024
1033
<select id="end-month" name="end-month">
1034
<?php for ( $i = 1; $i < 13; $i ++ ) { ?>
1035
<option
1036
+ value="<?php echo esc_attr( $i ); ?>" <?php selected( $end_month, $i ); ?>><?php echo esc_html( date_i18n( 'F', mktime( 0, 0, 0, $i, 2 ) ) ); ?></option>
1037
<?php } ?>
1038
</select>
1039
1390
<td>
1391
<?php
1392
$level = pmpro_getLevel( $order->membership_id );
1393
+ if ( ! empty( $level ) ) {
1394
+ echo $level->name;
1395
+ } elseif ( $order->membership_id > 0 ) { ?>
1396
+ [<?php _e( 'deleted', 'paid-memberships-pro' ); ?>]
1397
+ <?php } else { ?>
1398
+ [<?php _e( 'none', 'paid-memberships-pro' ); ?>]
1399
+ <?php }
1400
?>
1401
</td>
1402
<td><?php echo pmpro_formatPrice( $order->total ); ?></td>
adminpages/pagesettings.php CHANGED
@@ -39,6 +39,8 @@ if (!empty($_REQUEST['savesettings'])) {
39
pmpro_setOption("confirmation_page_id", NULL, 'intval');
40
pmpro_setOption("invoice_page_id", NULL, 'intval');
41
pmpro_setOption("levels_page_id", NULL, 'intval');
42
43
//update the pages array
44
$pmpro_pages["account"] = pmpro_getOption("account_page_id");
@@ -48,6 +50,8 @@ if (!empty($_REQUEST['savesettings'])) {
48
$pmpro_pages["confirmation"] = pmpro_getOption("confirmation_page_id");
49
$pmpro_pages["invoice"] = pmpro_getOption("invoice_page_id");
50
$pmpro_pages["levels"] = pmpro_getOption("levels_page_id");
51
52
//save additional pages
53
if (!empty($extra_pages)) {
@@ -74,6 +78,15 @@ if (!empty($_REQUEST['createpages'])) {
74
75
$pages = array();
76
77
if(empty($_REQUEST['page_name'])) {
78
//default pages
79
$pages['account'] = __('Membership Account', 'paid-memberships-pro' );
@@ -83,7 +96,34 @@ if (!empty($_REQUEST['createpages'])) {
83
$pages['confirmation'] = __('Membership Confirmation', 'paid-memberships-pro' );
84
$pages['invoice'] = __('Membership Invoice', 'paid-memberships-pro' );
85
$pages['levels'] = __('Membership Levels', 'paid-memberships-pro' );
86
87
} else {
88
//generate extra pages one at a time
89
$pmpro_page_name = sanitize_text_field($_REQUEST['page_name']);
@@ -105,7 +145,7 @@ require_once(dirname(__FILE__) . "/admin_header.php");
105
106
<form action="<?php echo admin_url('admin.php?page=pmpro-pagesettings');?>" method="post" enctype="multipart/form-data">
107
<?php wp_nonce_field('savesettings', 'pmpro_pagesettings_nonce');?>
108
-
109
<h1 class="wp-heading-inline"><?php esc_html_e( 'Page Settings', 'paid-memberships-pro' ); ?></h1>
110
<hr class="wp-header-end">
111
<?php
@@ -116,7 +156,8 @@ require_once(dirname(__FILE__) . "/admin_header.php");
116
$pmpro_pages['checkout'] ||
117
$pmpro_pages['confirmation'] ||
118
$pmpro_pages['invoice'] ||
119
- $pmpro_pages['levels'] ) {
120
$pmpro_some_pages_ready = true;
121
} else {
122
$pmpro_some_pages_ready = false;
@@ -275,6 +316,73 @@ require_once(dirname(__FILE__) . "/admin_header.php");
275
} ?>
276
</td>
277
</tr>
278
</tbody>
279
</table>
280
39
pmpro_setOption("confirmation_page_id", NULL, 'intval');
40
pmpro_setOption("invoice_page_id", NULL, 'intval');
41
pmpro_setOption("levels_page_id", NULL, 'intval');
42
+ pmpro_setOption("login_page_id", NULL, 'intval');
43
+ pmpro_setOption("member_profile_edit_page_id", NULL, 'intval');
44
45
//update the pages array
46
$pmpro_pages["account"] = pmpro_getOption("account_page_id");
50
$pmpro_pages["confirmation"] = pmpro_getOption("confirmation_page_id");
51
$pmpro_pages["invoice"] = pmpro_getOption("invoice_page_id");
52
$pmpro_pages["levels"] = pmpro_getOption("levels_page_id");
53
+ $pmpro_pages["login"] = pmpro_getOption("login_page_id");
54
+ $pmpro_pages['member_profile_edit'] = pmpro_getOption( 'member_profile_edit_page_id' );
55
56
//save additional pages
57
if (!empty($extra_pages)) {
78
79
$pages = array();
80
81
+ /**
82
+ * These pages were added later, and so we take extra
83
+ * care to make sure we only generate one version of them.
84
+ */
85
+ $generate_once = array(
86
+ 'member_profile_edit' => __( 'Your Profile', 'paid-memberships-pro' ),
87
+ 'login' => 'Log In',
88
+ );
89
+
90
if(empty($_REQUEST['page_name'])) {
91
//default pages
92
$pages['account'] = __('Membership Account', 'paid-memberships-pro' );
96
$pages['confirmation'] = __('Membership Confirmation', 'paid-memberships-pro' );
97
$pages['invoice'] = __('Membership Invoice', 'paid-memberships-pro' );
98
$pages['levels'] = __('Membership Levels', 'paid-memberships-pro' );
99
+ $pages['login'] = __('Log In', 'paid-memberships-pro' );
100
+ $pages['member_profile_edit'] = __('Your Profile', 'paid-memberships-pro' );
101
+ } elseif ( in_array( $_REQUEST['page_name'], array_keys( $generate_once ) ) ) {
102
+ $page_name = sanitize_text_field( $_REQUEST['page_name'] );
103
+ if ( ! empty( pmpro_getOption( $page_name . '_page_generated' ) ) ) {
104
+ // Don't generate again.
105
+ unset( $pages[$page_name] );
106
107
+ // Find the old page
108
+ $old_page = get_page_by_path( $page_name );
109
+ if ( ! empty( $old_page ) ) {
110
+ $pmpro_pages[$page_name] = $old_page->ID;
111
+ pmpro_setOption( $page_name . '_page_id', $old_page->ID );
112
+ pmpro_setOption( $page_name . '_page_generated', '1' );
113
+ $msg = true;
114
+ $msgt = sprintf( __( "Found an existing version of the %s page and used that one.", 'paid-memberships-pro' ), $page_name );
115
+ } else {
116
+ $msg = -1;
117
+ $msgt = sprintf( __( "Error generating the %s page. You will have to choose or create one manually.", 'paid-memberships-pro' ), $page_name );
118
+ }
119
+ } else {
120
+ // Generate the new Your Profile page and save an option that it was created.
121
+ $pages[$page_name] = array(
122
+ 'title' => $generate_once[$page_name],
123
+ 'content' => '[pmpro_' . $page_name . ']',
124
+ );
125
+ pmpro_setOption( $page_name . '_page_generated', '1' );
126
+ }
127
} else {
128
//generate extra pages one at a time
129
$pmpro_page_name = sanitize_text_field($_REQUEST['page_name']);
145
146
<form action="<?php echo admin_url('admin.php?page=pmpro-pagesettings');?>" method="post" enctype="multipart/form-data">
147
<?php wp_nonce_field('savesettings', 'pmpro_pagesettings_nonce');?>
148
+
149
<h1 class="wp-heading-inline"><?php esc_html_e( 'Page Settings', 'paid-memberships-pro' ); ?></h1>
150
<hr class="wp-header-end">
151
<?php
156
$pmpro_pages['checkout'] ||
157
$pmpro_pages['confirmation'] ||
158
$pmpro_pages['invoice'] ||
159
+ $pmpro_pages['levels'] ||
160
+ $pmpro_pages['member_profile_edit'] ) {
161
$pmpro_some_pages_ready = true;
162
} else {
163
$pmpro_some_pages_ready = false;
316
} ?>
317
</td>
318
</tr>
319
+ <tr>
320
+ <th scope="row" valign="top">
321
+ <label for="login_page_id"><?php esc_attr_e( 'Log In Page', 'paid-memberships-pro' ); ?>:</label>
322
+ </th>
323
+ <td>
324
+ <?php
325
+ wp_dropdown_pages(
326
+ array(
327
+ 'name' => 'login_page_id',
328
+ 'show_option_none' => '-- ' . __('Use WordPress Default', 'paid-memberships-pro') . ' --',
329
+ 'selected' => $pmpro_pages['login'], 'post_types' => $post_types
330
+ )
331
+ );
332
+ ?>
333
+
334
+ <?php if ( ! empty( $pmpro_pages['login'] ) ) { ?>
335
+ <a target="_blank" href="post.php?post=<?php echo $pmpro_pages['login'] ?>&action=edit"
336
+ class="button button-secondary pmpro_page_edit"><?php _e('edit page', 'paid-memberships-pro' ); ?></a>
337
+ &nbsp;
338
+ <a target="_blank" href="<?php echo get_permalink($pmpro_pages['login']); ?>"
339
+ class="button button-secondary pmpro_page_view"><?php _e('view page', 'paid-memberships-pro' ); ?></a>
340
+ <?php } elseif ( empty( pmpro_getOption( 'login_page_generated' ) ) ) { ?>
341
+ &nbsp;
342
+ <a href="<?php echo wp_nonce_url( add_query_arg( array( 'page' => 'pmpro-pagesettings', 'createpages' => 1, 'page_name' => esc_attr( 'login' ) ), admin_url('admin.php') ), 'createpages', 'pmpro_pagesettings_nonce' ); ?>"><?php _e('Generate Page', 'paid-memberships-pro' ); ?></a>
343
+ <?php } ?>
344
+ <p class="description"><?php printf( esc_html__('Include the shortcode %s or the Log In Form block.', 'paid-memberships-pro' ), '[pmpro_login]' ); ?></p>
345
+ </td>
346
+ </tr>
347
+ <tr>
348
+ <th scope="row" valign="top">
349
+ <label for="member_profile_edit_page_id"><?php esc_attr_e( 'Member Profile Edit Page', 'paid-memberships-pro' ); ?>:</label>
350
+ </th>
351
+ <td>
352
+ <?php
353
+ wp_dropdown_pages(
354
+ array(
355
+ 'name' => 'member_profile_edit_page_id',
356
+ 'show_option_none' => '-- ' . __('Use WordPress Default', 'paid-memberships-pro') . ' --',
357
+ 'selected' => $pmpro_pages['member_profile_edit'], 'post_types' => $post_types
358
+ )
359
+ );
360
+ ?>
361
+
362
+ <?php if ( ! empty( $pmpro_pages['member_profile_edit'] ) ) { ?>
363
+ <a target="_blank" href="post.php?post=<?php echo $pmpro_pages['member_profile_edit'] ?>&action=edit"
364
+ class="button button-secondary pmpro_page_edit"><?php _e('edit page', 'paid-memberships-pro' ); ?></a>
365
+ &nbsp;
366
+ <a target="_blank" href="<?php echo get_permalink($pmpro_pages['member_profile_edit']); ?>"
367
+ class="button button-secondary pmpro_page_view"><?php _e('view page', 'paid-memberships-pro' ); ?></a>
368
+ <?php } elseif ( empty( pmpro_getOption( 'member_profile_edit_page_generated' ) ) ) { ?>
369
+ &nbsp;
370
+ <a href="<?php echo wp_nonce_url( add_query_arg( array( 'page' => 'pmpro-pagesettings', 'createpages' => 1, 'page_name' => esc_attr( 'member_profile_edit' ) ), admin_url('admin.php') ), 'createpages', 'pmpro_pagesettings_nonce' ); ?>"><?php _e('Generate Page', 'paid-memberships-pro' ); ?></a>
371
+ <?php } ?>
372
+ <p class="description"><?php printf( esc_html__('Include the shortcode %s or the Member Profile Edit block.', 'paid-memberships-pro' ), '[pmpro_member_profile_edit]' ); ?></p>
373
+
374
+ <?php if ( ! class_exists( 'PMProRH_Field' ) ) {
375
+ $allowed_member_profile_edit_html = array (
376
+ 'a' => array (
377
+ 'href' => array(),
378
+ 'target' => array(),
379
+ 'title' => array(),
380
+ ),
381
+ );
382
+ echo '<br /><p class="description">' . sprintf( wp_kses( __( 'Optional: Collect additional member fields at checkout, on the profile, or for admin-use only using the <a href="%s" title="Paid Memberships Pro - Register Helper Add On" target="_blank">Register Helper Add On</a>.', 'paid-memberships-pro' ), $allowed_member_profile_edit_html ), 'https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/?utm_source=plugin&utm_medium=pmpro-pagesettings&utm_campaign=add-ons&utm_content=pmpro-register-helper' ) . '</p>';
383
+ } ?>
384
+ </td>
385
+ </tr>
386
</tbody>
387
</table>
388
adminpages/reports/memberships.php CHANGED
@@ -78,15 +78,15 @@ function pmpro_report_memberships_widget() {
78
<tr class="pmpro_report_tr">
79
<th scope="row">
80
<?php if ( empty( $signups ) && empty( $cancellations) ) { ?>
81
- <?php echo $report_name; ?>
82
<?php } else { ?>
83
<button class="pmpro_report_th pmpro_report_th_closed">
84
- <?php echo $report_name; ?>
85
</button>
86
<?php } ?>
87
</th>
88
- <td><?php echo $signups; ?></td>
89
- <td><?php echo $cancellations; ?></td>
90
</tr>
91
<?php
92
//level stats
@@ -97,9 +97,9 @@ function pmpro_report_memberships_widget() {
97
if($count++ >= $max_level_count) break;
98
?>
99
<tr class="pmpro_report_tr_sub" style="display: none;">
100
- <th scope="row">- <?php echo $level->name;?></th>
101
- <td><?php echo number_format_i18n(pmpro_getSignups($report_type, $level->id)); ?></td>
102
- <td><?php echo number_format_i18n(pmpro_getCancellations($report_type, $level->id)); ?></td>
103
</tr>
104
<?php
105
}
@@ -111,7 +111,7 @@ function pmpro_report_memberships_widget() {
111
</table>
112
<?php if ( function_exists( 'pmpro_report_memberships_page' ) ) { ?>
113
<p class="pmpro_report-button">
114
- <a class="button button-primary" href="<?php echo admin_url( 'admin.php?page=pmpro-reports&report=memberships' ); ?>"><?php _e('Details', 'paid-memberships-pro' );?></a>
115
</p>
116
<?php } ?>
117
</span>
@@ -301,8 +301,8 @@ function pmpro_report_memberships_page()
301
else
302
$sqlQuery .= "WHERE mu1.status IN('inactive','expired','cancelled','admin_cancelled') ";
303
304
- $sqlQuery .= "AND mu1.startdate >= '" . esc_sql( $startdate ) . "'
305
- AND mu1.startdate < '" . esc_sql( $enddate ) . "' ";
306
307
//restrict by level
308
if ( ! empty( $l ) ) {
@@ -360,12 +360,12 @@ function pmpro_report_memberships_page()
360
<span id="for"><?php _e('for', 'paid-memberships-pro' )?></span>
361
<select id="month" name="month">
362
<?php for($i = 1; $i < 13; $i++) { ?>
363
- <option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date_i18n("F", mktime(0, 0, 0, $i, 2));?></option>
364
<?php } ?>
365
</select>
366
<select id="year" name="year">
367
<?php for($i = $thisyear; $i > 2007; $i--) { ?>
368
- <option value="<?php echo $i;?>" <?php selected($year, $i);?>><?php echo $i;?></option>
369
<?php } ?>
370
</select>
371
<span id="for"><?php _e('for', 'paid-memberships-pro' )?></span>
@@ -378,7 +378,7 @@ function pmpro_report_memberships_page()
378
foreach($levels as $level)
379
{
380
?>
381
- <option value="<?php echo $level->id?>" <?php if($l == $level->id) { ?>selected="selected"<?php } ?>><?php echo $level->name?></option>
382
<?php
383
}
384
@@ -393,13 +393,13 @@ function pmpro_report_memberships_page()
393
<select id="discount_code" name="discount_code">
394
<option value="" <?php if ( empty( $discount_code ) ) { ?>selected="selected"<?php } ?>><?php _e('All Codes', 'paid-memberships-pro' );?></option>
395
<?php foreach ( $codes as $code ) { ?>
396
- <option value="<?php echo $code->id; ?>" <?php selected( $discount_code, $code->id ); ?>><?php echo $code->code; ?></option>
397
<?php } ?>
398
</select>
399
<?php } ?>
400
<input type="hidden" name="page" value="pmpro-reports" />
401
<input type="hidden" name="report" value="memberships" />
402
- <input type="submit" class="button" value="<?php _e('Generate Report', 'paid-memberships-pro' );?>" />
403
</li>
404
</ul>
405
@@ -445,23 +445,23 @@ function pmpro_report_memberships_page()
445
446
var data = google.visualization.arrayToDataTable([
447
<?php if ( $type === "signup_v_all" ) : // Signups vs. all cancellations ?>
448
- ['<?php echo $date_function;?>', 'Signups', 'All Cancellations'],
449
<?php foreach($dates as $key => $value) { ?>
450
- ['<?php if($period == "monthly") echo date_i18n("M", mktime(0,0,0,$value->date,2)); else if($period == "daily") echo $key; else echo $value->date;?>', <?php echo $value->signups; ?>, <?php echo $value->cancellations; ?>],
451
<?php } ?>
452
<?php endif; ?>
453
454
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
455
- ['<?php echo $date_function;?>', 'Signups', 'Cancellations'],
456
<?php foreach($dates as $key => $value) { ?>
457
- ['<?php if($period == "monthly") echo date_i18n("M", mktime(0,0,0,$value->date,2)); else if($period == "daily") echo $key; else echo $value->date;?>', <?php echo $value->signups; ?>, <?php echo $value->cancellations; ?>],
458
<?php } ?>
459
<?php endif; ?>
460
461
<?php if ( $type === "signup_v_expiration" ) : // Signups vs. expirations ?>
462
- ['<?php echo $date_function;?>', 'Signups', 'Expirations'],
463
<?php foreach($dates as $key => $value) { ?>
464
- ['<?php if($period == "monthly") echo date_i18n("M", mktime(0,0,0,$value->date,2)); else if($period == "daily") echo $key; else echo $value->date;?>', <?php echo $value->signups; ?>, <?php echo $value->cancellations; ?>],
465
<?php } ?>
466
<?php endif; ?>
467
@@ -476,7 +476,7 @@ function pmpro_report_memberships_page()
476
textStyle: {color: '#555555', fontSize: '12', italic: false}
477
},
478
hAxis: {
479
- title: '<?php echo $date_function;?>',
480
textStyle: {color: '#555555', fontSize: '12', italic: false},
481
titleTextStyle: {color: '#555555', fontSize: '20', bold: true, italic: false},
482
maxAlternation: 1
78
<tr class="pmpro_report_tr">
79
<th scope="row">
80
<?php if ( empty( $signups ) && empty( $cancellations) ) { ?>
81
+ <?php echo esc_html($report_name); ?>
82
<?php } else { ?>
83
<button class="pmpro_report_th pmpro_report_th_closed">
84
+ <?php echo esc_html($report_name); ?>
85
</button>
86
<?php } ?>
87
</th>
88
+ <td><?php echo esc_html($signups); ?></td>
89
+ <td><?php echo esc_html($cancellations); ?></td>
90
</tr>
91
<?php
92
//level stats
97
if($count++ >= $max_level_count) break;
98
?>
99
<tr class="pmpro_report_tr_sub" style="display: none;">
100
+ <th scope="row">- <?php echo esc_html($level->name);?></th>
101
+ <td><?php echo esc_html(number_format_i18n(pmpro_getSignups($report_type, $level->id))); ?></td>
102
+ <td><?php echo esc_html(number_format_i18n(pmpro_getCancellations($report_type, $level->id))); ?></td>
103
</tr>
104
<?php
105
}
111
</table>
112
<?php if ( function_exists( 'pmpro_report_memberships_page' ) ) { ?>
113
<p class="pmpro_report-button">
114
+ <a class="button button-primary" href="<?php echo esc_url(admin_url( 'admin.php?page=pmpro-reports&report=memberships')); ?>"><?php _e('Details', 'paid-memberships-pro' );?></a>
115
</p>
116
<?php } ?>
117
</span>
301
else
302
$sqlQuery .= "WHERE mu1.status IN('inactive','expired','cancelled','admin_cancelled') ";
303
304
+ $sqlQuery .= "AND mu1.enddate >= '" . esc_sql( $startdate ) . "'
305
+ AND mu1.enddate < '" . esc_sql( $enddate ) . "' ";
306
307
//restrict by level
308
if ( ! empty( $l ) ) {
360
<span id="for"><?php _e('for', 'paid-memberships-pro' )?></span>
361
<select id="month" name="month">
362
<?php for($i = 1; $i < 13; $i++) { ?>
363
+ <option value="<?php echo esc_attr($i);?>" <?php selected($month, $i);?>><?php echo esc_html(date_i18n("F", mktime(0, 0, 0, $i, 2)));?></option>
364
<?php } ?>
365
</select>
366
<select id="year" name="year">
367
<?php for($i = $thisyear; $i > 2007; $i--) { ?>
368
+ <option value="<?php echo esc_attr($i);?>" <?php selected($year, $i);?>><?php echo esc_html($i);?></option>
369
<?php } ?>
370
</select>
371
<span id="for"><?php _e('for', 'paid-memberships-pro' )?></span>
378
foreach($levels as $level)
379
{
380
?>
381
+ <option value="<?php echo esc_attr($level->id)?>" <?php if($l == $level->id) { ?>selected="selected"<?php } ?>><?php echo esc_html($level->name);?></option>
382
<?php
383
}
384
393
<select id="discount_code" name="discount_code">
394
<option value="" <?php if ( empty( $discount_code ) ) { ?>selected="selected"<?php } ?>><?php _e('All Codes', 'paid-memberships-pro' );?></option>
395
<?php foreach ( $codes as $code ) { ?>
396
+ <option value="<?php echo esc_attr($code->id); ?>" <?php selected( $discount_code, $code->id ); ?>><?php echo esc_html($code->code); ?></option>
397
<?php } ?>
398
</select>
399
<?php } ?>
400
<input type="hidden" name="page" value="pmpro-reports" />
401
<input type="hidden" name="report" value="memberships" />
402
+ <input type="submit" class="button" value="<?php esc_attr_e('Generate Report', 'paid-memberships-pro' );?>" />
403
</li>
404
</ul>
405
445
446
var data = google.visualization.arrayToDataTable([
447
<?php if ( $type === "signup_v_all" ) : // Signups vs. all cancellations ?>
448
+ ['<?php echo esc_html($date_function);?>', 'Signups', 'All Cancellations'],
449
<?php foreach($dates as $key => $value) { ?>
450
+ ['<?php if($period == "monthly") echo esc_html(date_i18n("M", mktime(0,0,0,$value->date,2))); else if($period == "daily") echo esc_html($key); else echo esc_html($value->date);?>', <?php echo esc_html($value->signups); ?>, <?php echo esc_html($value->cancellations); ?>],
451
<?php } ?>
452
<?php endif; ?>
453
454
<?php if ( $type === "signup_v_cancel" ) : // Signups vs. cancellations ?>
455
+ ['<?php echo esc_html($date_function);?>', 'Signups', 'Cancellations'],
456
<?php foreach($dates as $key => $value) { ?>
457
+ ['<?php if($period == "monthly") echo esc_html(date_i18n("M", mktime(0,0,0,$value->date,2))); else if($period == "daily") echo esc_html($key); else echo esc_html($value->date);?>', <?php echo esc_html($value->signups); ?>, <?php echo esc_html($value->cancellations); ?>],
458
<?php } ?>
459
<?php endif; ?>
460
461
<?php if ( $type === "signup_v_expiration" ) : // Signups vs. expirations ?>
462
+ ['<?php echo esc_html($date_function);?>', 'Signups', 'Expirations'],
463
<?php foreach($dates as $key => $value) { ?>
464
+ ['<?php if($period == "monthly") echo esc_html(date_i18n("M", mktime(0,0,0,$value->date,2))); else if($period == "daily") echo esc_html($key); else echo esc_html($value->date);?>', <?php echo esc_html($value->signups); ?>, <?php echo esc_html($value->cancellations); ?>],
465
<?php } ?>
466
<?php endif; ?>
467
476
textStyle: {color: '#555555', fontSize: '12', italic: false}
477
},
478
hAxis: {
479
+ title: '<?php echo esc_html($date_function);?>',
480
textStyle: {color: '#555555', fontSize: '12', italic: false},
481
titleTextStyle: {color: '#555555', fontSize: '20', bold: true, italic: false},
482
maxAlternation: 1
adminpages/reports/sales.php CHANGED
@@ -63,13 +63,13 @@ function pmpro_report_sales_widget() {
63
<tr class="pmpro_report_tr">
64
<th scope="row">
65
<?php if( ! empty( $prices ) ) { ?>
66
- <button class="pmpro_report_th pmpro_report_th_closed"><?php echo $report_name; ?></button>
67
<?php } else { ?>
68
- <?php echo $report_name; ?>
69
<?php } ?>
70
</th>
71
- <td><?php echo number_format_i18n( pmpro_getSales( $report_type ) ); ?></td>
72
- <td><?php echo pmpro_formatPrice( pmpro_getRevenue( $report_type ) ); ?></td>
73
</tr>
74
<?php
75
//sale prices stats
@@ -82,9 +82,9 @@ function pmpro_report_sales_widget() {
82
}
83
?>
84
<tr class="pmpro_report_tr_sub" style="display: none;">
85
- <th scope="row">- <?php echo pmpro_formatPrice( $price );?></th>
86
- <td><?php echo number_format_i18n( $quantity ); ?></td>
87
- <td><?php echo pmpro_formatPrice( $price * $quantity ); ?></td>
88
</tr>
89
<?php
90
}
@@ -96,7 +96,7 @@ function pmpro_report_sales_widget() {
96
</table>
97
<?php if ( function_exists( 'pmpro_report_sales_page' ) ) { ?>
98
<p class="pmpro_report-button">
99
- <a class="button button-primary" href="<?php echo admin_url( 'admin.php?page=pmpro-reports&report=sales' ); ?>"><?php _e('Details', 'paid-memberships-pro' );?></a>
100
</p>
101
<?php } ?>
102
</span>
@@ -298,12 +298,12 @@ function pmpro_report_sales_page()
298
<span id="for"><?php _e('for', 'paid-memberships-pro' )?></span>
299
<select id="month" name="month">
300
<?php for($i = 1; $i < 13; $i++) { ?>
301
- <option value="<?php echo $i;?>" <?php selected($month, $i);?>><?php echo date_i18n("F", mktime(0, 0, 0, $i, 2));?></option>
302
<?php } ?>
303
</select>
304
<select id="year" name="year">
305
<?php for($i = $thisyear; $i > 2007; $i--) { ?>
306
- <option value="<?php echo $i;?>" <?php selected($year, $i);?>><?php echo $i;?></option>
307
<?php } ?>
308
</select>
309
<span id="for"><?php _e('for', 'paid-memberships-pro' )?></span>
@@ -314,7 +314,7 @@ function pmpro_report_sales_page()
314
foreach($levels as $level)
315
{
316
?>
317
- <option value="<?php echo $level->id?>" <?php if($l == $level->id) { ?>selected="selected"<?php } ?>><?php echo $level->name?></option>
318
<?php
319
}
320
?>
@@ -327,7 +327,7 @@ function pmpro_report_sales_page()
327
<select id="discount_code" name="discount_code">
328
<option value="" <?php if ( empty( $discount_code ) ) { ?>selected="selected"<?php } ?>><?php _e('All Codes', 'paid-memberships-pro' );?></option>
329
<?php foreach ( $codes as $code ) { ?>
330
- <option value="<?php echo $code->id; ?>" <?php selected( $discount_code, $code->id ); ?>><?php echo $code->code; ?></option>
331
<?php } ?>
332
</select>
333
<?php } ?>
@@ -377,17 +377,17 @@ function pmpro_report_sales_page()
377
378
var data = google.visualization.arrayToDataTable([
379
[
380
- { label: '<?php echo $date_function;?>' },
381
- { label: '<?php echo ucwords($type);?>' },
382
{ label: '<?php _e( 'Average*', 'paid-memberships-pro' );?>' },
383
],
384
<?php foreach($cols as $date => $value) { ?>
385
['<?php
386
if($period == "monthly") {
387
- echo date_i18n("M", mktime(0,0,0,$date,2));
388
} else {
389
- echo $date;
390
- } ?>', <?php echo pmpro_round_price( $value );?>, <?php echo pmpro_round_price( $average );?>],
391
<?php } ?>
392
]);
393
@@ -401,7 +401,7 @@ function pmpro_report_sales_page()
401
?>'],
402
chartArea: {width: '90%'},
403
hAxis: {
404
- title: '<?php echo $date_function;?>',
405
textStyle: {color: '#555555', fontSize: '12', italic: false},
406
titleTextStyle: {color: '#555555', fontSize: '20', bold: true, italic: false},
407
maxAlternation: 1
@@ -433,10 +433,10 @@ function pmpro_report_sales_page()
433
}
434
?>
435
var formatter = new google.visualization.NumberFormat({
436
- <?php echo $position;?>: '<?php echo html_entity_decode($pmpro_currency_symbol); ?>',
437
- 'decimalSymbol': '<?php echo html_entity_decode( $decimal_separator ); ?>',
438
'fractionDigits': <?php echo intval( $decimals ); ?>,
439
- 'groupingSymbol': '<?php echo html_entity_decode( $thousands_separator ); ?>',
440
});
441
formatter.format(data, 1);
442
formatter.format(data, 2);
@@ -608,6 +608,26 @@ function pmpro_getRevenue($period, $levels = NULL)
608
return $revenue;
609
}
610
611
//delete transients when an order goes through
612
function pmpro_report_sales_delete_transients()
613
{
63
<tr class="pmpro_report_tr">
64
<th scope="row">
65
<?php if( ! empty( $prices ) ) { ?>
66
+ <button class="pmpro_report_th pmpro_report_th_closed"><?php echo esc_html($report_name); ?></button>
67
<?php } else { ?>
68
+ <?php echo esc_html($report_name); ?>
69
<?php } ?>
70
</th>
71
+ <td><?php echo esc_html( number_format_i18n( pmpro_getSales( $report_type ) ) ); ?></td>
72
+ <td><?php echo esc_html(pmpro_formatPrice( pmpro_getRevenue( $report_type ) ) ); ?></td>
73
</tr>
74
<?php
75
//sale prices stats
82
}
83
?>
84
<tr class="pmpro_report_tr_sub" style="display: none;">
85
+ <th scope="row">- <?php echo esc_html( pmpro_formatPrice( $price ) );?></th>
86
+ <td><?php echo esc_html( number_format_i18n( $quantity ) ); ?></td>
87
+ <td><?php echo esc_html( pmpro_formatPrice( $price * $quantity ) ); ?></td>
88
</tr>
89
<?php
90
}
96
</table>
97
<?php if ( function_exists( 'pmpro_report_sales_page' ) ) { ?>
98
<p class="pmpro_report-button">
99
+ <a class="button button-primary" href="<?php echo esc_url( admin_url( 'admin.php?page=pmpro-reports&report=sales' ) ); ?>"><?php _e('Details', 'paid-memberships-pro' );?></a>
100
</p>
101
<?php } ?>
102
</span>
298
<span id="for"><?php _e('for', 'paid-memberships-pro' )?></span>
299
<select id="month" name="month">
300
<?php for($i = 1; $i < 13; $i++) { ?>
301
+ <option value="<?php echo esc_attr( $i );?>" <?php selected($month, $i);?>><?php echo esc_html(date_i18n("F", mktime(0, 0, 0, $i, 2)));?></option>
302
<?php } ?>
303
</select>
304
<select id="year" name="year">
305
<?php for($i = $thisyear; $i > 2007; $i--) { ?>
306
+ <option value="<?php echo esc_attr( $i );?>" <?php selected($year, $i);?>><?php echo esc_html( $i );?></option>
307
<?php } ?>
308
</select>
309
<span id="for"><?php _e('for', 'paid-memberships-pro' )?></span>
314
foreach($levels as $level)
315
{
316
?>
317
+ <option value="<?php echo esc_attr( $level->id ); ?>" <?php if($l == $level->id) { ?>selected="selected"<?php } ?>><?php echo esc_html( $level->name); ?></option>
318
<?php
319
}
320
?>
327
<select id="discount_code" name="discount_code">
328
<option value="" <?php if ( empty( $discount_code ) ) { ?>selected="selected"<?php } ?>><?php _e('All Codes', 'paid-memberships-pro' );?></option>
329
<?php foreach ( $codes as $code ) { ?>
330
+ <option value="<?php echo esc_attr( $code->id ); ?>" <?php selected( $discount_code, $code->id ); ?>><?php echo esc_html( $code->code ); ?></option>
331
<?php } ?>
332
</select>
333
<?php } ?>
377
378
var data = google.visualization.arrayToDataTable([
379
[
380
+ { label: '<?php echo esc_html( $date_function );?>' },
381
+ { label: '<?php echo esc_html( ucwords( $type ) );?>' },
382
{ label: '<?php _e( 'Average*', 'paid-memberships-pro' );?>' },
383
],
384
<?php foreach($cols as $date => $value) { ?>
385
['<?php
386
if($period == "monthly") {
387
+ echo esc_html(date_i18n("M", mktime(0,0,0,$date,2)));
388
} else {
389
+ echo esc_html( $date );
390
+ } ?>', <?php echo esc_html( pmpro_round_price( $value ) );?>, <?php echo esc_html( pmpro_round_price( $average ) );?>],
391
<?php } ?>
392
]);
393
401
?>'],
402
chartArea: {width: '90%'},
403
hAxis: {
404
+ title: '<?php echo esc_html( $date_function );?>',
405
textStyle: {color: '#555555', fontSize: '12', italic: false},
406
titleTextStyle: {color: '#555555', fontSize: '20', bold: true, italic: false},
407
maxAlternation: 1
433
}
434
?>
435
var formatter = new google.visualization.NumberFormat({
436
+ <?php echo esc_html( $position );?>: '<?php echo esc_html( html_entity_decode($pmpro_currency_symbol) ); ?>',
437
+ 'decimalSymbol': '<?php echo esc_html( html_entity_decode( $decimal_separator ) ); ?>',
438
'fractionDigits': <?php echo intval( $decimals ); ?>,
439
+ 'groupingSymbol': '<?php echo esc_html( html_entity_decode( $thousands_separator ) ); ?>',
440
});
441
formatter.format(data, 1);
442
formatter.format(data, 2);
608
return $revenue;
609
}
610
611
+ /**
612
+ * Get revenue between dates.
613
+ *
614
+ * @param string $start_date to track revenue from.
615
+ * @param string $end_date to track revenue until. Defaults to current date. YYYY-MM-DD format.
616
+ * @param array $level_ids to include in report. Defaults to all.
617
+ * @return float revenue.
618
+ */
619
+ function pmpro_get_revenue_between_dates( $start_date, $end_date = '', $level_ids = null ) {
620
+ global $wpdb;
621
+ $sql_query = "SELECT SUM(total) FROM $wpdb->pmpro_membership_orders WHERE status NOT IN('refunded', 'review', 'token', 'error') AND timestamp >= '" . esc_sql( $start_date ) . " 00:00:00'";
622
+ if ( ! empty( $end_date ) ) {
623
+ $sql_query .= " AND timestamp <= '" . esc_sql( $end_date ) . " 23:59:59'";
624
+ }
625
+ if ( ! empty( $level_ids ) ) {
626
+ $sql_query .= ' AND membership_id IN(' . implode( ', ', $levels ) . ') ';
627
+ }
628
+ return $wpdb->get_var($sql_query);
629
+ }
630
+
631
//delete transients when an order goes through
632
function pmpro_report_sales_delete_transients()
633
{
blocks/account-invoices-section/block.js CHANGED
@@ -4,31 +4,14 @@
4
* Displays the Membership Account > Invoices page section.
5
*
6
*/
7
- /**
8
- * Block dependencies
9
- */
10
- import './editor.css';
11
- import classnames from 'classnames';
12
/**
13
* Internal block libraries
14
*/
15
const { __ } = wp.i18n;
16
const {
17
- registerBlockType,
18
- AlignmentToolbar,
19
- BlockControls,
20
- BlockAlignmentToolbar,
21
} = wp.blocks;
22
- const {
23
- PanelBody,
24
- PanelRow,
25
- TextControl,
26
- } = wp.components;
27
-
28
- const {
29
- RichText,
30
- InspectorControls,
31
- } = wp.editor;
32
33
/**
34
* Register block
@@ -49,12 +32,11 @@ const {
49
},
50
attributes: {
51
},
52
- edit: props => {
53
- const { className } = props;
54
return [
55
- <div className={ className }>
56
- <span>Paid Memberships Pro</span>
57
- <span>Membership Account: Invoices</span>
58
</div>
59
];
60
},
4
* Displays the Membership Account > Invoices page section.
5
*
6
*/
7
+
8
/**
9
* Internal block libraries
10
*/
11
const { __ } = wp.i18n;
12
const {
13
+ registerBlockType
14
} = wp.blocks;
15
16
/**
17
* Register block
32
},
33
attributes: {
34
},
35
+ edit() {
36
return [
37
+ <div className="pmpro-block-element">
38
+ <span className="pmpro-block-title">{ __( 'Paid Memberships Pro', 'paid-memberships-pro' ) }</span>
39
+ <span className="pmpro-block-subtitle"> { __( 'Membership Account: Invoices', 'paid-memberships-pro' ) }</span>
40
</div>
41
];
42
},
blocks/account-invoices-section/editor.css DELETED
@@ -1,19 +0,0 @@
1
- .edit-post-layout .wp-block-pmpro-account-invoices-section {
2
- background: #FAFAFA;
3
- padding: 20px;
4
- text-align: center;
5
- }
6
- .edit-post-layout .wp-block-pmpro-account-invoices-section span {
7
- color: #AAA;
8
- display: block;
9
- font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif;
10
- font-weight: 700;
11
- position: relative;
12
- text-transform: uppercase;
13
- }
14
- .edit-post-layout .wp-block-pmpro-account-invoices-section span:first-child {
15
- font-size: 125%;
16
- font-weight: 300;
17
- letter-spacing: 1px;
18
- margin-bottom: 10px;
19
- }
blocks/account-links-section/block.js CHANGED
@@ -4,31 +4,14 @@
4