PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.17.1
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.17.1
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 / OrdersPage / SettingsPage.php
wp-user-avatar / src / Admin / SettingsPages / Membership / OrdersPage Last commit date
OrderWPListTable.php 1 year ago SettingsPage.php 1 week ago index.php 4 years ago
SettingsPage.php
621 lines
1 <?php
2
3 namespace ProfilePress\Core\Admin\SettingsPages\Membership\OrdersPage;
4
5 use ProfilePress\Core\Admin\SettingsPages\AbstractSettingsPage;
6 use ProfilePress\Core\Admin\SettingsPages\Membership\ContextualStateChangeHelper;
7 use ProfilePress\Core\Base;
8 use ProfilePress\Core\Membership\CheckoutFields;
9 use ProfilePress\Core\Membership\Models\Coupon\CouponFactory;
10 use ProfilePress\Core\Membership\Models\Coupon\CouponUnit;
11 use ProfilePress\Core\Membership\Models\Customer\CustomerFactory;
12 use ProfilePress\Core\Membership\Models\Order\OrderFactory;
13 use ProfilePress\Core\Membership\Models\Order\OrderStatus;
14 use ProfilePress\Core\Membership\Models\Plan\PlanFactory;
15 use ProfilePress\Core\Membership\Models\Subscription\SubscriptionFactory;
16 use ProfilePress\Core\Membership\PaymentMethods\BankTransfer\BankTransfer;
17 use ProfilePress\Core\Membership\PaymentMethods\PaymentMethods;
18 use ProfilePress\Core\Membership\Repositories\PlanRepository;
19 use ProfilePress\Core\Membership\Services\Calculator;
20 use ProfilePress\Core\Membership\Services\CouponService;
21 use ProfilePress\Core\Membership\Services\OrderService;
22 use ProfilePress\Core\Membership\Services\TaxService;
23 use ProfilePress\Custom_Settings_Page_Api;
24 use ProfilePressVendor\Carbon\CarbonImmutable;
25
26 class SettingsPage extends AbstractSettingsPage
27 {
28 public $error_bucket;
29
30 /** @var OrderWPListTable */
31 private $orderListTable;
32
33 function __construct()
34 {
35 add_action('ppress_register_menu_page', [$this, 'register_cpf_settings_page']);
36 add_action('ppress_admin_settings_page_orders', [$this, 'settings_page_function']);
37
38 if (ppressGET_var('page') == PPRESS_MEMBERSHIP_ORDERS_SETTINGS_SLUG) {
39 add_filter('set-screen-option', [__CLASS__, 'set_screen'], 10, 3);
40 add_filter('set_screen_option_rules_per_page', [__CLASS__, 'set_screen'], 10, 3);
41
42 add_action('admin_init', function () {
43 $this->save_order();
44 $this->add_order();
45 $this->refund_order();
46 });
47 }
48
49 add_action('wp_ajax_ppress_mb_search_plans', [$this, 'search_membership_plans']);
50 add_action('wp_ajax_ppress_mb_search_customers', [$this, 'search_customers']);
51 add_action('wp_ajax_ppress_delete_order_note', [$this, 'delete_order_note']);
52 add_action('wp_ajax_ppress_mb_order_modal_search', [$this, 'search_plan_coupon']);
53 add_action('wp_ajax_ppress_modal_replace_order_item', [$this, 'replace_order_item_modal']);
54 }
55
56 public function default_header_menu()
57 {
58 return 'orders';
59 }
60
61 public function register_cpf_settings_page()
62 {
63 $hook = add_submenu_page(
64 PPRESS_DASHBOARD_SETTINGS_SLUG,
65 $this->admin_page_title() . ' - ProfilePress',
66 esc_html__('Orders', 'wp-user-avatar'),
67 'manage_options',
68 PPRESS_MEMBERSHIP_ORDERS_SETTINGS_SLUG,
69 array($this, 'admin_page_callback'));
70
71 add_action("load-$hook", array($this, 'add_options'));
72
73 do_action('ppress_membership_orders_settings_page_register', $hook);
74 }
75
76 public function search_membership_plans()
77 {
78 if ( ! current_user_can('manage_options')) return;
79
80 check_ajax_referer('ppress-admin-nonce', 'nonce');
81
82 global $wpdb;
83
84 $plans_table = Base::subscription_plans_db_table();
85
86 $search = '%' . $wpdb->esc_like(sanitize_text_field($_GET['search'])) . '%';
87
88 $results['results'] = [];
89
90 $plans = $wpdb->get_results(
91 $wpdb->prepare("SELECT id, name FROM $plans_table WHERE name LIKE %s", $search),
92 ARRAY_A
93 );
94
95 if (is_array($plans) && ! empty($plans)) {
96
97 foreach ($plans as $plan) {
98
99 if ( ! empty($plan['id'])) {
100
101 $plan_id = (int)$plan['id'];
102
103 $results['results'][$plan_id] = [
104 'id' => $plan_id,
105 'text' => esc_html($plan['name'])
106 ];
107 }
108 }
109 }
110
111 $results['results'] = array_values($results['results']);
112
113 wp_send_json($results, 200);
114 }
115
116 public function search_customers()
117 {
118 if ( ! current_user_can('manage_options')) return;
119
120 check_ajax_referer('ppress-admin-nonce', 'nonce');
121
122 global $wpdb;
123
124 $wp_user_table = $wpdb->users;
125 $wp_user_meta = $wpdb->usermeta;
126 $customer_Table = Base::customers_db_table();
127
128 $search = '%' . $wpdb->esc_like(sanitize_text_field($_GET['search'])) . '%';
129
130
131 $results['results'] = [];
132
133 $users = $wpdb->get_results(
134 $wpdb->prepare(
135 "SELECT customer.id AS customer_id FROM $wp_user_table AS user
136 LEFT JOIN $wp_user_meta AS usermeta on usermeta.user_id = user.id
137 LEFT JOIN $customer_Table AS customer on customer.user_id = user.id
138 WHERE user_email LIKE %s OR (usermeta.meta_key = 'first_name' AND usermeta.meta_value LIKE %s) OR (usermeta.meta_key = 'last_name' AND usermeta.meta_value LIKE %s)",
139 [$search, $search, $search]
140 ),
141 ARRAY_A
142 );
143
144 if (is_array($users) && ! empty($users)) {
145 foreach ($users as $user) {
146 if ( ! empty($user['customer_id'])) {
147 $customer_id = (int)$user['customer_id'];
148 $results['results'][$customer_id] = array(
149 'id' => $customer_id,
150 'text' => CustomerFactory::fromId($customer_id)->get_name(),
151 );
152 }
153 }
154 }
155
156 $results['results'] = array_values($results['results']);
157
158 wp_send_json($results, 200);
159 }
160
161 public function search_plan_coupon()
162 {
163 if ( ! current_user_can('manage_options')) return;
164
165 check_ajax_referer('ppress-admin-nonce', 'nonce');
166
167 global $wpdb;
168
169 $search = sanitize_text_field(ppressGET_var('search'));
170
171 $results['results'] = [];
172
173 if ( ! empty($search)) {
174
175 if (ppressGET_var('type') == 'subscription-plans') {
176 $table = Base::subscription_plans_db_table();
177 $result = $wpdb->get_results(
178 $wpdb->prepare(
179 "SELECT id, name, price FROM $table WHERE name LIKE %s",
180 '%' . $wpdb->esc_like($search) . '%'
181 )
182 );
183
184 if ( ! empty($result)) {
185 foreach ($result as $plan) {
186 $results['prices'][$plan->id] = ppress_sanitize_amount($plan->price);
187 $results['results'][] = array(
188 'id' => $plan->id,
189 'text' => $plan->name
190 );
191 }
192 }
193 }
194
195 if (ppressGET_var('type') == 'order_coupon') {
196 $table = Base::coupons_db_table();
197 $result = $wpdb->get_results(
198 $wpdb->prepare(
199 "SELECT id, code FROM $table WHERE code LIKE %s",
200 '%' . $wpdb->esc_like($search) . '%'
201 )
202 );
203
204 if ( ! empty($result)) {
205 foreach ($result as $coupon) {
206 $results['results'][] = array(
207 'id' => $coupon->id,
208 'text' => $coupon->code,
209 );
210 }
211 }
212 }
213 }
214
215 wp_send_json($results, 200);
216 }
217
218 public function delete_order_note()
219 {
220 if ( ! current_user_can('manage_options')) return;
221
222 check_ajax_referer('ppress-admin-nonce', 'security');
223
224 OrderService::init()->delete_order_note_by_id(intval($_POST['note_id']));
225
226 wp_send_json_success();
227 }
228
229 public function replace_order_item_modal()
230 {
231 if ( ! current_user_can('manage_options')) return;
232
233 check_ajax_referer('ppress-admin-nonce', 'security');
234
235 $order_id = (int)$_POST['order_id'];
236 $plan_id = (int)$_POST['plan'];
237 $plan_price = sanitize_text_field($_POST['plan_price']);
238 $coupon_id = (int)$_POST['coupon_code'];
239 $tax_amount = sanitize_text_field($_POST['tax']);
240
241 $plan_price = ! empty($plan_price) ? ppress_sanitize_amount($plan_price) : PlanFactory::fromId($plan_id)->get_price();
242
243 $order = OrderFactory::fromId($order_id);
244 $order->plan_id = ppress_sanitize_amount($plan_id);
245 $order->coupon_code = '';
246 $order->discount = '0.00';
247 $order->tax = '0.00';
248 $order->subtotal = $plan_price;
249
250 if ( ! empty($coupon_id)) {
251
252 $couponObj = CouponFactory::fromId($coupon_id);
253
254 $order->coupon_code = $couponObj->code;
255 $order->discount = $couponObj->get_amount();
256
257 if ($couponObj->unit == CouponUnit::PERCENTAGE) {
258
259 $order->discount = CouponService::init()->get_coupon_percentage_fee(
260 $couponObj->get_amount(),
261 Calculator::init($order->subtotal)->val()
262 );
263 }
264 }
265
266 if (TaxService::init()->is_tax_enabled() && ! empty($tax_amount)) {
267 $order->tax = ppress_sanitize_amount($tax_amount);
268 }
269
270 $order_total = Calculator::init($order->subtotal)->plus($order->tax)->minus($order->discount);
271
272 if (TaxService::init()->is_tax_enabled() && ! empty($tax_amount) && TaxService::init()->is_price_inclusive_tax()) {
273
274 $subtotal = Calculator::init($plan_price)->minus($order->discount)->minus($order->tax);
275
276 $order->subtotal = $subtotal->val();
277
278 if ($subtotal->isNegativeOrZero()) $order->subtotal = '0.00';
279
280 $order_total = Calculator::init($order->subtotal)->plus($order->tax);
281 }
282
283 $order->total = $order_total->val();
284
285 if ($order_total->isNegativeOrZero()) $order->total = '0.00';
286
287 $order->save();
288
289 wp_send_json_success();
290 }
291
292 public function refund_order()
293 {
294 if (ppressGET_var('ppress_order_action') == 'refund_order') {
295
296 check_admin_referer('ppress-cancel-order');
297
298 if (current_user_can('manage_options')) {
299
300 $order_id = intval($_GET['id']);
301
302 OrderService::init()->process_order_refund($order_id);
303
304 wp_safe_redirect(add_query_arg(['ppress_order_action' => 'edit', 'id' => $order_id, 'saved' => 'true'], PPRESS_MEMBERSHIP_ORDERS_SETTINGS_PAGE));
305 exit;
306 }
307 }
308 }
309
310 /**
311 * @return void
312 */
313 public function save_order()
314 {
315 if ( ! isset($_POST['ppress_save_order'])) return;
316
317 ppress_verify_nonce();
318
319 if ( ! current_user_can('manage_options')) return;
320
321 $order = OrderFactory::fromId(absint(ppressGET_var('id')));
322 $old_status = $order->status;
323
324 $order->date_created = ppress_local_datetime_to_utc(sanitize_text_field($_POST['order_date']));
325 if (in_array($_POST['order_status'], array_keys(OrderStatus::get_all()))) {
326 $order->status = sanitize_text_field($_POST['order_status']);
327 }
328
329 $order->customer_id = absint($_POST['customer_user']);
330
331 foreach ($_POST as $key => $value) {
332
333 if (in_array($key, array_keys(CheckoutFields::standard_billing_fields()))) {
334
335 $key = str_replace('ppress_', '', $key);
336
337 $order->$key = ppress_clean($value, 'sanitize_text_field');
338 }
339 }
340
341 $order_id = $order->save();
342
343 if ($order_id && OrderStatus::PENDING == $old_status && OrderStatus::COMPLETED == $order->status) {
344
345 $order->complete_order();
346
347 if ($order->payment_method == BankTransfer::get_instance()->get_id()) {
348
349 $sub = SubscriptionFactory::fromId($order->subscription_id);
350
351 if ($sub && $sub->exists()) {
352 $sub->has_trial() ? $sub->enable_subscription_trial() : $sub->activate_subscription();
353 }
354 }
355 }
356
357 wp_safe_redirect(add_query_arg(['ppress_order_action' => 'edit', 'id' => $order_id, 'saved' => 'true'], PPRESS_MEMBERSHIP_ORDERS_SETTINGS_PAGE));
358 exit;
359 }
360
361 /**
362 * @return void|string
363 */
364 public function add_order()
365 {
366 if ( ! isset($_POST['save_ppress_orders'])) return;
367
368 if ( ! current_user_can('manage_options')) {
369 wp_die(__('You do not have permission to perform this action.', 'wp-user-avatar'), __('Error', 'wp-user-avatar'), array('response' => 403));
370 }
371
372 check_admin_referer('wp-csa-nonce', 'wp_csa_nonce');
373
374 $order_data = ppressPOST_var('ppress_orders', []);
375
376 if (empty($order_data['plan'])) {
377 wp_die(__('No plan was selected. Please try again.', 'wp-user-avatar'), __('Error', 'wp-user-avatar'), array('response' => 403));
378 }
379
380 if (empty($order_data['customer'])) {
381 wp_die(__('No customer was selected. Please try again.', 'wp-user-avatar'), __('Error', 'wp-user-avatar'), array('response' => 403));
382 }
383
384 $date_created = current_time('mysql');
385
386 if ( ! empty($order_data['order_date'])) {
387 $date_created = CarbonImmutable::parse(sanitize_text_field($order_data['order_date']), wp_timezone())
388 ->setTimeFromTimeString(CarbonImmutable::now(wp_timezone())->toTimeString())
389 ->utc()->toDateTimeString();
390 }
391
392 if (empty($order_data['amount']) || Calculator::init($order_data['amount'])->isNegativeOrZero()) {
393 $order_data['amount'] = ppress_get_plan($order_data['plan'])->get_price();
394 }
395
396 $response = ppress_subscribe_user_to_plan(
397 $order_data['plan'],
398 $order_data['customer'],
399 [
400 'amount' => $order_data['amount'],
401 'order_status' => $order_data['order_status'],
402 'payment_method' => $order_data['payment_method'],
403 'transaction_id' => $order_data['transaction_id'],
404 'date_created' => $date_created
405 ],
406 $order_data['send_receipt'] == 'true'
407 );
408
409 if (is_wp_error($response)) {
410
411 wp_die(
412 $response->get_error_message(),
413 __('Error', 'wp-user-avatar'),
414 array('response' => 400)
415 );
416 }
417
418 wp_safe_redirect(esc_url_raw(OrderWPListTable::view_edit_order_url($response['order_id'])));
419 exit;
420 }
421
422 public function admin_page_title()
423 {
424 $title = esc_html__('Orders', 'wp-user-avatar');
425
426 if (ppressGET_var('ppress_order_action') == 'new') {
427 $title = esc_html__('Add New Order', 'wp-user-avatar');
428 }
429
430 if (ppressGET_var('ppress_order_action') == 'edit') {
431 $title = esc_html__('Edit Order', 'wp-user-avatar');
432 }
433
434 return $title;
435 }
436
437 public static function set_screen($status, $option, $value)
438 {
439 return $value;
440 }
441
442 public function add_options()
443 {
444 $args = [
445 'label' => esc_html__('Orders', 'wp-user-avatar'),
446 'default' => 10,
447 'option' => 'orders_per_page'
448 ];
449
450 add_screen_option('per_page', $args);
451
452 $this->orderListTable = new OrderWPListTable();
453 }
454
455 public function admin_notices()
456 {
457 if ( ! isset($_GET['saved']) && ! isset($this->error_bucket)) return;
458
459 $status = 'updated';
460 $message = '';
461
462 if ( ! empty($this->error_bucket)) {
463 $message = $this->error_bucket;
464 $status = 'error';
465 }
466
467 if (isset($_GET['saved'])) {
468 $message = esc_html__('Changes saved.', 'wp-user-avatar');
469 }
470
471 printf('<div id="message" class="%s notice is-dismissible"><p>%s</strong></p></div>', $status, $message);
472 }
473
474 public function settings_page_function()
475 {
476 add_filter('wp_cspa_main_content_area', [$this, 'admin_settings_page_callback'], 10, 2);
477 add_action('wp_cspa_before_closing_header', [$this, 'add_new_button']);
478 add_action('wp_cspa_form_tag', function ($option_name) {
479 if ($option_name == 'ppress_orders') {
480 printf(' action="%s"', ppress_get_current_url_query_string());
481 }
482 });
483
484 $instance = Custom_Settings_Page_Api::instance();
485 if ( ! isset($_GET['ppress_order_action'])) {
486 $instance->form_method('get');
487 $instance->remove_nonce_field();
488 }
489
490 if (ppressGET_var('ppress_order_action') == 'new') {
491
492 $instance->main_content([
493 [
494 'plan' => [
495 'label' => __('Membership Plan', 'wp-user-avatar'),
496 'type' => 'select',
497 'options' => (function () {
498 return array_reduce(PlanRepository::init()->retrieveAll(), function ($carry, $item) {
499 $carry[$item->id] = $item->name;
500
501 return $carry;
502 }, ['' => '&mdash;&mdash;&mdash;&mdash;']);
503 })()
504 ],
505 'customer' => [
506 'label' => __('Customer', 'wp-user-avatar'),
507 'type' => 'select',
508 'options' => [],
509 'attributes' => ['class' => 'ppress-select2-field customer_user']
510 ],
511 'amount' => [
512 'label' => __('Amount', 'wp-user-avatar'),
513 'type' => 'text',
514 'placeholder' => ppress_display_amount('0.00'),
515 'description' => esc_html__('Enter the total order amount, or leave blank to use the price of the selected plan.', 'wp-user-avatar')
516 ],
517 'order_status' => [
518 'label' => __('Order Status', 'wp-user-avatar'),
519 'type' => 'select',
520 'options' => OrderStatus::get_all()
521 ],
522 'payment_method' => [
523 'label' => __('Payment Method', 'wp-user-avatar'),
524 'type' => 'select',
525 'options' => (function () {
526 return apply_filters(
527 'ppress_admin_order_page_enabled_payment_methods',
528 array_reduce(PaymentMethods::get_instance()->get_all(), function ($carry, $item) {
529 $carry[$item->id] = $item->method_title;
530
531 return $carry;
532 }, ['' => '&mdash;&mdash;&mdash;&mdash;']));
533 })()
534 ],
535 'transaction_id' => [
536 'label' => __('Transaction ID', 'wp-user-avatar'),
537 'type' => 'text',
538 'description' => esc_html__('Enter the transaction ID, if any.', 'wp-user-avatar')
539 ],
540 'order_date' => [
541 'label' => __('Date', 'wp-user-avatar'),
542 'type' => 'text',
543 'class' => 'ppress_datepicker',
544 'description' => esc_html__("Enter the purchase date, or leave blank for today's date.", 'wp-user-avatar')
545 ],
546 'send_receipt' => [
547 'label' => __('Send Receipt', 'wp-user-avatar'),
548 'checkbox_label' => __('Check to send the order receipt to the customer.', 'wp-user-avatar'),
549 'type' => 'checkbox',
550 'default_value' => 'true'
551 ]
552 ]
553 ]);
554
555 $instance->remove_white_design();
556
557 $instance->sidebar(self::sidebar_args());
558 }
559
560 $instance->add_view_classes('ppview');
561 $instance->option_name('ppress_orders');
562 $instance->page_header($this->admin_page_title());
563 $instance->build(ppressGET_var('ppress_order_action') != 'new');
564 }
565
566 public function add_new_button()
567 {
568 if ( ! isset($_GET['ppress_order_action'])) {
569 $url = esc_url_raw(add_query_arg('ppress_order_action', 'new', PPRESS_MEMBERSHIP_ORDERS_SETTINGS_PAGE));
570 echo "<a class=\"add-new-h2\" href=\"$url\">" . esc_html__('Add New Order', 'wp-user-avatar') . '</a>';
571 }
572
573 if (ppressGET_var('ppress_order_action') == 'edit') {
574 $url = esc_url_raw(PPRESS_MEMBERSHIP_ORDERS_SETTINGS_PAGE);
575 echo "<a class=\"add-new-h2\" href=\"$url\">" . esc_html__('Back to Orders', 'wp-user-avatar') . '</a>';
576 }
577 }
578
579 public function admin_settings_page_callback($content)
580 {
581 if (ppressGET_var('ppress_order_action') == 'new') {
582 return $content;
583 }
584
585 if (ppressGET_var('ppress_order_action') == 'edit') {
586 $this->admin_notices();
587 ContextualStateChangeHelper::init();
588 require_once dirname(dirname(__FILE__)) . '/views/orders/add-edit-order.php';
589
590 return;
591 }
592
593 $this->orderListTable->prepare_items();
594
595 echo '<input type="hidden" name="page" value="' . PPRESS_MEMBERSHIP_ORDERS_SETTINGS_SLUG . '" />';
596 echo '<input type="hidden" name="view" value="orders" />';
597 if (isset($_GET['status'])) {
598 echo '<input type="hidden" name="status" value="' . esc_attr($_GET['status']) . '" />';
599 }
600 if (isset($_GET['by_ci'])) {
601 echo '<input type="hidden" name="by_ci" value="' . esc_attr($_GET['by_ci']) . '" />';
602 }
603 $this->orderListTable->views();
604 $this->orderListTable->filter_bar();
605 $this->orderListTable->display();
606
607 do_action('ppress_order_wp_list_table_bottom');
608 }
609
610 public static function get_instance()
611 {
612 static $instance = null;
613
614 if (is_null($instance)) {
615 $instance = new self();
616 }
617
618 return $instance;
619 }
620 }
621