PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.0.3
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.0.3
4.17.3 4.17.2 4.17.1 4.17.0 4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / Admin / SettingsPages / Membership / views / add-edit-plan.php
wp-user-avatar / src / Admin / SettingsPages / Membership / views Last commit date
customers 4 years ago orders 4 years ago subscriptions 4 years ago add-edit-coupon.php 4 years ago add-edit-plan.php 4 years ago checkout-field-item.php 4 years ago checkout-fields.php 4 years ago coupons-page-sidebar.php 4 years ago index.php 4 years ago payment-method-list.php 4 years ago plans-page-sidebar.php 4 years ago tax-rates-setup.php 4 years ago
add-edit-plan.php
201 lines
1 <?php
2
3 use ProfilePress\Core\Admin\SettingsPages\Membership\SettingsFieldsParser;
4 use ProfilePress\Core\Membership\Models\Subscription\SubscriptionBillingFrequency;
5 use ProfilePress\Core\Membership\Models\Subscription\SubscriptionTrialPeriod;
6
7 $plan_details = [
8 [
9 'id' => 'name',
10 'type' => 'text',
11 'label' => esc_html__('Plan Name', 'wp-user-avatar')
12 ],
13 [
14 'id' => 'description',
15 'type' => 'wp_editor',
16 'label' => esc_html__('Plan Description', 'wp-user-avatar'),
17 'description' => esc_html__('A description of this plan. This will be displayed on the checkout page.', 'wp-user-avatar')
18 ],
19 [
20 'id' => 'price',
21 'type' => 'price',
22 'label' => esc_html__('Price', 'wp-user-avatar') . sprintf(' (%s)', ppress_get_currency_symbol()),
23 'description' => esc_html__('The price of this membership plan. Enter 0 to make this plan free.', 'wp-user-avatar')
24 ]
25 ];
26
27 $subscription_settings = [
28 [
29 'id' => 'billing_frequency',
30 'type' => 'select',
31 'label' => esc_html__('Billing Frequency', 'wp-user-avatar'),
32 'options' => SubscriptionBillingFrequency::get_all()
33 ],
34 [
35 'id' => 'subscription_length',
36 'type' => 'select',
37 'label' => esc_html__('Subscription Length', 'wp-user-avatar'),
38 'options' => [
39 'renew_indefinitely' => esc_html__('Renew indefinitely until member cancels', 'wp-user-avatar'),
40 'fixed' => esc_html__('Fixed number of payments', 'wp-user-avatar')
41 ]
42 ],
43 [
44 'id' => 'total_payments',
45 'type' => 'number',
46 'label' => esc_html__('Total Payments', 'wp-user-avatar'),
47 'description' => esc_html__('The total number of recurring billing cycles including the trial period (if applicable). Keep in mind that once a member has completed the last payment, the subscription will not expire — essentially giving them lifetime access.', 'wp-user-avatar')
48 ],
49 [
50 'id' => 'signup_fee',
51 'type' => 'price',
52 'label' => esc_html__('Signup Fee', 'wp-user-avatar') . sprintf(' (%s)', ppress_get_currency_symbol()),
53 'description' => esc_html__('Optional signup fee to charge subscribers for the first billing cycle.', 'wp-user-avatar')
54 ],
55 [
56 'id' => 'free_trial',
57 'type' => 'select',
58 'options' => SubscriptionTrialPeriod::get_all(),
59 'label' => esc_html__('Free Trial', 'wp-user-avatar'),
60 'description' => esc_html__('Allow members free access for a specified duration of time before charging them.', 'wp-user-avatar')
61 ]
62 ];
63
64 $plan_data = ppress_get_plan(absint(ppressGET_var('id')));
65
66 if (ppressGET_var('ppress_subp_action') == 'edit' && ! $plan_data->exists()) {
67 ppress_content_http_redirect(PPRESS_MEMBERSHIP_PLANS_SETTINGS_SLUG);
68
69 return;
70 }
71
72 add_action('add_meta_boxes', function () use ($subscription_settings, $plan_details, $plan_data) {
73 add_meta_box(
74 'ppress-membership-plan-content',
75 esc_html__('Plan Details', 'wp-user-avatar'),
76 function () use ($plan_details, $plan_data) {
77 echo '<div class="ppress-membership-plan-details">';
78 (new SettingsFieldsParser($plan_details, $plan_data))->build();
79 echo '</div>';
80 },
81 'ppmembershipplan'
82 );
83
84 add_meta_box(
85 'ppress-subscription-plan-settings',
86 esc_html__('Subscription Settings', 'wp-user-avatar'),
87 function () use ($subscription_settings, $plan_data) {
88 echo '<div class="ppress-subscription-plan-settings">';
89 (new SettingsFieldsParser($subscription_settings, $plan_data))->build();
90 echo '</div>';
91 },
92 'ppmembershipplan'
93 );
94
95 add_meta_box(
96 'submitdiv',
97 __('Publish', 'wp-user-avatar'),
98 function () {
99 require dirname(__FILE__) . '/plans-page-sidebar.php';
100 },
101 'ppmembershipplan',
102 'sidebar'
103 );
104
105 add_meta_box(
106 'ppress-subscription-plan-summary',
107 __('Summary', 'wp-user-avatar'),
108 function () {
109 ?>
110 <div class="ppress-subscription-plan-summary-content">
111 </div>
112 <?php
113 },
114 'ppmembershipplan',
115 'sidebar'
116 );
117
118 if ($plan_data->exists()) {
119 add_meta_box(
120 'ppress-subscription-plan-links',
121 __('Order Links', 'wp-user-avatar'),
122 function () use ($plan_data) {
123 $checkout_url = $plan_data->get_checkout_url();
124 ?>
125 <div class="ppress-subscription-plan-payment-links">
126 <p>
127 <label><?php _e('Checkout link:', 'wp-user-avatar'); ?>
128 <input type="text" onfocus="this.select();" readonly="readonly" value="<?= esc_url($checkout_url) ?>"/>
129 </label>
130 </p>
131 </div>
132 <?php
133 },
134 'ppmembershipplan',
135 'sidebar'
136 );
137 }
138 });
139
140 do_action('add_meta_boxes', 'ppmembershipplan', new WP_Post(new stdClass()));
141 ?>
142 <div id="poststuff">
143 <div id="post-body" class="metabox-holder columns-2">
144 <div id="postbox-container-1" class="postbox-container">
145 <?php do_meta_boxes('ppmembershipplan', 'sidebar', ''); ?>
146 </div>
147 <div id="postbox-container-2" class="postbox-container">
148 <?php do_meta_boxes('ppmembershipplan', 'advanced', ''); ?>
149 </div>
150 </div>
151 <br class="clear">
152 </div>
153
154 <?php add_action('admin_footer', function () { ?>
155 <script type="text/javascript">
156 (function ($) {
157
158 $('#billing_frequency').on('change', function () {
159
160 if ($(this).val() !== 'lifetime') {
161
162 $('#field-role-signup_fee').show();
163 $('#field-role-free_trial').show();
164
165 $('#field-role-subscription_length').show()
166 .find('.ppress-plan-control').change();
167 } else {
168 $('#field-role-subscription_length').hide();
169 $('#field-role-total_payments').hide();
170 $('#field-role-signup_fee').hide();
171 $('#field-role-free_trial').hide();
172 }
173 });
174
175 $('#subscription_length').on('change', function () {
176 $('#field-role-total_payments').toggle($(this).val() === 'fixed');
177 });
178
179 $('#billing_frequency').change();
180
181 $(window).on('load', function () {
182 var tmpl = wp.template('ppress-plan-summary');
183
184 $('.ppress-plan-control').on('change', function () {
185 $('#ppress-subscription-plan-summary .ppress-subscription-plan-summary-content').html(
186 tmpl({
187 'price': $('.form-field #price').val(),
188 'billing_frequency': $('.form-field #billing_frequency').val(),
189 'total_payments': $('.form-field #total_payments').val(),
190 'signup_fee': $('.form-field #signup_fee').val(),
191 'subscription_length': $('.form-field #subscription_length').val(),
192 'free_trial': $('.form-field #free_trial').val(),
193 })
194 );
195 }).change();
196
197 });
198 })(jQuery);
199 </script>
200 <?php
201 });