UserManager.php
24.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
<?php
/*
Plugin Name: CBV User Manager
Description: All-In-One User Management for CBV
Version: 1.0
Author: Tenzing Communications Inc.
Author URI: http://www.gotenzing.com
*/
namespace Tz\WordPress\Tools\UserManager;
use Tz\Common;
use Tz\WordPress\Tools;
use Tz\WordPress\Tools\Auth;
use Tz\WordPress\UAM;
use Tz\WordPress\Tools\HTML;
use Tz\WordPress\CBV;
use Tz\WordPress\CBV\User;
use Tz\WordPress\CBV\Events;
use Tz\WordPress\CBV\CEHours;
use Exception, StdClass;
use WP_User;
const OPTION_NAME = "user_options";
const CAPABILITY = "manage_cbv_users";
CBV\load('User');
Tools\import('HTML');
call_user_func(function() {
$role = get_role('administrator');
$role->add_cap(CAPABILITY);
Tools\add_actions(__NAMESPACE__ . '\Actions');
Vars::$validation = new StdClass;
Vars::$validation->errors = Array();
});
function display_users() {
global $wpdb;
// temporary - remove when done...
$query = $wpdb->get_results("SELECT ID FROM {$wpdb->users}");
foreach($query as $user) {
$status = get_user_meta($user->ID, 'status', true);
if (empty($status)) {
update_user_meta($user->ID, 'status', 'active');
}
}
// end temporary.
if ( isset($_GET['action']) && ($_GET['action']=="edit") && isset($_GET['uid']) && ($_GET['uid'] > 0) ) {
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'edit_user.php');
} elseif (isset($_GET['action']) && $_GET['action']=="edit-partial") {
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'edit_'.$_GET['section'].'.php');
} else {
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'display_users.php');
}
}
function search_special_status($key) {
$special_statuses = get_user_meta($_GET['uid'], 'special_statuses',true);
if (!empty($special_statuses)) {
foreach($special_statuses as $stat) {
if ($stat == $key) {
echo 'checked';
break;
}
}
}
}
function get_users($role = null, $pagenum=1, $records_per_page=0, $return_count_only = false, $search = null) {
global $wpdb;
$users = array();
if ($search) {
$search = strip_tags($search);
$search_text = "AND (uml.meta_value LIKE '%$search%' OR umf.meta_value LIKE '%$search%')";
} else {
$search_text = "";
}
$blog_prefix = $wpdb->get_blog_prefix();
if ($role) {
$extra_table = "";//", {$wpdb->usermeta} as umc";
//$filter = "AND (umc.user_id=u.ID AND umc.meta_key='wp_capabilites' AND umc.meta_value LIKE '%$role%')";
$filter = "AND u.ID IN (SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key='wp_capabilities' AND meta_value LIKE '%$role%')";
} else {
$extra_table = "";
$filter = "";
}
$query = "
SELECT
u.ID, u.user_login, user_email, uml.meta_value as last_name, umf.meta_value as first_name
FROM
{$wpdb->users} as u, {$wpdb->usermeta} as uml, {$wpdb->usermeta} as umf, {$wpdb->usermeta} as ums $extra_table
WHERE
(uml.user_id=u.ID AND uml.meta_key='last_name')
AND (umf.user_id=u.ID AND umf.meta_key='first_name')
AND (ums.user_id=u.ID AND ums.meta_key='status')
$filter
$search_text
ORDER BY last_name ASC, first_name ASC
";
/*
$query = "
SELECT u.ID, u.user_login, CONCAT('{', GROUP_CONCAT(CONCAT('"', m.meta_key, '"', ':', '"', m.meta_value, '"')), '}') AS meta_data, (SELECT meta_value FROM wp_usermeta as mt where meta_key = 'last_name' and mt.user_id = u.ID) AS ln
FROM wp_users as u left join wp_usermeta as m on u.ID = m.user_id where m.meta_key IN ('first_name', 'last_name')
GROUP BY u.ID
ORDER BY ln;
");
*/
if ($records_per_page > 0) {
$limit = " LIMIT ".( ($pagenum - 1) * $records_per_page ).", $records_per_page";
} else {
$limit = "";
}
$wp_user_search = $wpdb->get_results($query.$limit);
if ($return_count_only) {
return $wpdb->num_rows;
} else {
foreach ( $wp_user_search as $user ) {
$uid = (int) $user->ID;
$user = new WP_User($uid);
reset($user->roles);
$role = ucwords(current($user->roles));
$users[] = array('uid'=>$uid,'first_name'=>$user->first_name,'last_name'=>$user->last_name,'role'=>$role, 'user_login'=>$user->user_login, 'email'=>$user->user_email, 'status'=>$user->status);
}
return $users;
}
}
function create_user() {
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create_user.php');
}
class ProfileValidation extends Common\Validation {
public function prefix($val) {
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function member_since($val) {
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function first_name($val) {
if(empty($val)) {
throw new Exception('First name cannot be blank');
} else {
update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
}
}
public function initial($val) {
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function last_name($val) {
if(empty($val)) {
throw new Exception('Last name cannot be blank');
} else {
update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
}
}
public function degrees($val) {
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function description($val) {
update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
}
public function date_of_birth($val) {
if (!empty($val)) {
if (!HTML\validateDate($val)) {
throw new Exception(User\Vars::$field_lookup[__FUNCTION__] . ' must be in YYYY-MM-DD format.');
}
}
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function address($val) {
update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
}
public function address2($val) {
update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
}
public function city($val) {
update_user_meta($_POST['uid'], __FUNCTION__, User\clean_string($val));
}
public function province($val) {
if (empty($val)) {
throw new Exception('Province field can not be empty');
}
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function postal($val) {
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function country($val) {
if (empty($val)) {
throw new Exception('Country field can not be empty');
}
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function phone($val) {
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function fax($val) {
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function mobile($val) {
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
public function email($val) {
if (!empty($val)) {
if (!(boolean)preg_match(CBV\VALID_EMAIL, (string)$val)) {
throw new Exception('An invalid email address was entered in Email');
}
} else {
throw new Exception('Email field can not be empty');
}
// update user email.
wp_update_user( Array ('ID'=>$_POST['uid'] , 'user_email'=>$val) );
//update_user_meta($_POST['uid'], 'email', $val);
}
public function company($val) {
update_user_meta($_POST['uid'],'company', User\clean_string($val));
}
public function title($val) {
update_user_meta($_POST['uid'], 'title', User\clean_string($val));
}
public function website($val) {
if (!empty($val)) {
if (substr($val, 0, 7) != 'http://' && substr($val, 0, 8) != 'https://') {
$val = 'http://' . $val;
}
if (!(boolean)filter_var($val, FILTER_VALIDATE_URL)) {
throw new Exception('An invalid url was entered in website');
}
}
update_user_meta($_POST['uid'], 'website', User\clean_string($val));
}
public function profile_preference($val) {
update_user_meta($_POST['uid'], 'profile_preference', $val);
}
public function email_address_preference($val) {
update_user_meta($_POST['uid'], 'email_address_preference', $val);
}
}
class AccountValidation extends Common\Validation {
public function status($val) {
update_user_meta($_POST['uid'], 'status',$val);
}
public function special_status_active($vals) {
delete_usermeta($_POST['uid'], 'special_statuses');
if (isset($_POST['special_status'])) {
$s = $_POST['special_status'];
if (count($s) > 0) {
update_user_meta($_POST['uid'], 'special_statuses', $s);
}
}
}
public function user_role($val) {
$user = new WP_User($_POST['uid']);
try {
$user->set_role($val);
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
}
public function password1($val) {
if (!empty($_POST['password1']) || !empty($_POST['password2'])) {
if ($_POST['password1']==$_POST['password2']) {
// update the user's password...
_update_user(Array('ID' => $_POST['uid'], 'user_pass' => $_POST['password1']));
} else {
throw new Exception('Passwords must match.');
}
}
}
}
class CreateValidation extends Common\Validation {
public function first_name($val) {
if(empty($val)) {
throw new Exception(User\Vars::$field_lookup[__FUNCTION__] . ' cannot be blank');
}
}
public function last_name($val) {
if(empty($val)) {
throw new Exception(User\Vars::$field_lookup[__FUNCTION__] . ' cannot be blank');
}
}
public function username($val) {
if(empty($val)) {
throw new Exception(User\Vars::$field_lookup[__FUNCTION__] . ' cannot be blank');
}
}
public function email($val) {
if (!empty($val)) {
if (!(boolean)preg_match(CBV\VALID_EMAIL, (string)$val)) {
throw new Exception('An invalid email address was entered in ' . User\Vars::$field_lookup[__FUNCTION__]);
}
} else {
throw new Exception(User\Vars::$field_lookup[__FUNCTION__] . ' field can not be empty');
}
}
public function country($val) {
if(empty($val)) {
throw new Exception(User\Vars::$field_lookup[__FUNCTION__] . ' cannot be blank');
}
}
public function province($val) {
if(empty($val)) {
throw new Exception(User\Vars::$field_lookup[__FUNCTION__] . ' cannot be blank');
}
}
public function user_role($val) {
if(empty($val)) {
throw new Exception(User\Vars::$field_lookup[__FUNCTION__] . ' cannot be blank');
}
}
public function password($val) {
if(!empty($val)) {
if ($_POST['password'] != $_POST['password2']) {
throw new Exception('Passwords do not match');
}
} else {
throw new Exception(User\Vars::$field_lookup[__FUNCTION__] . ' cannot be blank');
}
}
}
function run_validation() {
$section = $_POST['section'];
$class = __NAMESPACE__ . '\\' . ucwords(array_shift(explode('-', $section))) . 'Validation';
Vars::$validation = new $class($_POST);
return (count(Vars::$validation->errors) > 0 ? false : true);
}
class Actions {
public static function wp_ajax_remove_user() {
$remove_action = $_POST['remove_action'];
if ($remove_action=="remove_all") {
// oh boy....
@wp_delete_user( $_POST['uid'] );
} else {
update_user_meta($_POST['uid'], 'status', 'terminated');
}
$return = array(
'success' => 'true'
);
die(json_encode($return));
}
public static function wp_ajax_build_user_remove() {
$uid = $_GET['uid'];
ob_start();
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'remove_user.php');
$content = ob_get_contents();
ob_end_clean();
die($content);
}
public static function wp_ajax_admin_create_user() {
run_validation();
Tools\import('Auth');
$valid = (count(Vars::$validation->errors) > 0) ? false : true;
if ($valid) {
$user_role = $_POST['user_role']; unset($_POST['user_role']);
$username = $_POST['username']; unset($_POST['username']);
$email = $_POST['email']; unset($_POST['email']);
if ($user_role != "member") { unset($_POST['member_id']); }
$password = $_POST['password']; unset($_POST['password']); unset($_POST['password2']);
// register the user.
$user_details = Array(
'first_name' => User\clean_string($_POST['first_name'])
, 'last_name' => User\clean_string($_POST['last_name'])
, 'province' => $_POST['province']
, 'country' => $_POST['country']
, 'email' => $email
);
unset($user_details['email']);
if (isset($_POST['member_id'])) { $user_details['member_id'] = $_POST['member_id']; }
$user_details = array_merge(User\Vars::$meta_defaults, $user_details);
try {
$user_key = Auth\register($username, $email, $password, $user_details);
$uid = Auth\activate($user_key, $password);
$u = new WP_User($uid);
$u->set_role($user_role);
update_user_meta($uid, 'validated', time());
} catch (Exception $e) {
$return = array(
'success' => false
, 'msg' => $e->getMessage()
);
die(json_encode($return));
}
$return = array(
'success' => 'true'
, 'edit_profile' => '/wp-admin/admin.php?page=cbv_users&action=edit&uid='.$uid.'§ion=profile'
, 'msg' => '<li>' . implode('</li><li>', Vars::$validation->errors) . '</li>'
);
} else {
$return = array(
'success' => 'false'
, 'msg' => '<li>' . implode('</li><li>', Vars::$validation->errors) . '</li>'
);
}
die(json_encode($return));
}
public static function wp_ajax_admin_create_member_id() {
// do logic here to create the user's member id.
$member_id = $_POST['last_name'] . time();
$return = array(
'member_id' => $member_id
);
die(json_encode($return));
}
public static function wp_ajax_admin_remove_cehours() {
CBV\load('CEHours');
$cehours = CEHours\get_user_cehours($_POST['uid']);
$compare = $_POST['indexed'];
if (isset($cehours[$compare])) {
unset($cehours[$compare]);
}
update_user_meta($_POST['uid'], 'cehours',$cehours);
$return = array(
'success' => 'true'
);
die(json_encode($return));
}
public static function wp_ajax_update_edit_profile() {
run_validation();
$return = array(
'success' => (count(Vars::$validation->errors) > 0 ? 'false' : 'true')
, 'msg' => '<li>' . implode('</li><li>', Vars::$validation->errors) . '</li>'
);
die(json_encode($return));
}
public static function wp_ajax_cancel_registration() {
CBV\load('Events');
Events\cancel_registration($_POST['uid'], $_POST['eid']);
$event = get_post($_POST['eid']);
$cost = get_post_meta($_POST['eid'], 'cost', true);
if (empty($cost) || $cost < 1 || strtolower($cost)=="free") {
$cost = 0;
}
$return = array(
'success' => 'true',
'ask_credit' => (($cost > 0) ? 'true' : 'false')
);
die(json_encode($return));
}
public static function wp_ajax_update_account() {
run_validation();
$return = array(
'success' => (count(Vars::$validation->errors) > 0 ? 'false' : 'true')
, 'msg' => '<li>' . implode('</li><li>', Vars::$validation->errors) . '</li>'
);
die(json_encode($return));
}
public static function wp_ajax_post_credit() {
$uid = $_POST['uid'];
$post_id = $_POST['event_id']; // could be an event, or a course.
$amount = $_POST['amount'];
// post credit to their account.
// return json object
$return = array(
'success' => 'true'
);
die(json_encode($return));
}
public static function wp_ajax_update_registration() {
CBV\load('Events');
if (!isset($_POST['type'])) { die('Invalid Form Post'); }
$uid = $_POST['uid'];
$event_id = $_POST['event_id'];
$type = $_POST['type'];
$status = $_POST['status'];
unset($_POST['action']);
unset($_POST['ajax']);
unset($_POST['event_id']);
unset($_POST['uid']);
unset($_POST['type']);
unset($_POST['status']);
$events = get_user_meta($uid, 'events',true);
// if $type = "edit"
if ($type=="edit") {
foreach($events as $index=>$event) {
if ($event['event_id']==$event_id) {
$events[$index]['status'] = $status;
unset($events[$index]['extras']);
$events[$index]['extras'] = $_POST;
break;
}
}
update_user_meta($uid, 'events', $events);
$return = array('success' => 'true', 'refresh' => 'false');
} else {
Events\set_attending($uid,$event_id,$status,'',$_POST);
$return = array('success' => 'true', 'refresh' => 'true');
}
die(json_encode($return));
}
public static function wp_ajax_admin_update_cehours() {
CBV\load('CEHours');
$cehours = CEHours\get_user_cehours($_POST['uid']);
if ($_POST['action']=="edit") {
unset($cehours[$_POST['indexed']]);
}
$timestamp = CEHours\mysqldatetime_to_timestamp($_POST['date']);
$cehours[$timestamp] = Array(
'type' => $_POST['type']
, 'date' => $timestamp
, 'activity' => $_POST['activity']
, 'hours' => $_POST['hours']
);
update_user_meta($_POST['uid'], 'cehours', $cehours);
// return json object
$return = array(
'success' => 'true'
);
die(json_encode($return));
}
public static function wp_ajax_build_cehour_form() {
$user = new WP_User($_GET['uid']);
$uid = $user->ID;
$fname = get_user_meta($user->ID, 'first_name', true);
$lname = get_user_meta($user->ID, 'last_name', true);
if (empty($fname) || empty($lname)) {
$name = $user->user_login;
} else {
$name = $fname . " " . $lname;
}
CBV\load('CEHours');
ob_start();
$action = isset($_GET['post_action']) ? $_GET['post_action'] : "edit";
$cehours = CEHours\get_user_cehours($uid);
if ($action=="edit") {
$record = $cehours[$_GET['indexed']];
$indexed = $_GET['indexed'];
$type = $record['type'];
$date = date('Y-m-d',$record['date']);
$activity = $record['activity'];
$hours = $record['hours'];
} else {
$indexed = "";
$type = "unstructured";
$date = date('Y-m-d',time());
$activity = "";
$hours = "0";
}
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'edit_cehour.php');
$content = ob_get_contents();
ob_end_clean();
die($content);
}
public static function wp_ajax_build_event_form() {
$user = new WP_User($_GET['uid']);
$uid = $user->ID;
reset($user->roles);
$role = current($user->roles);
$fname = get_user_meta($user->ID, 'first_name', true);
$lname = get_user_meta($user->ID, 'last_name', true);
if (empty($fname) || empty($lname)) {
$name = $user->user_login;
} else {
$name = $fname . " " . $lname;
}
CBV\load('Events');
ob_start();
$action = isset($_GET['post_action']) ? $_GET['post_action'] : "edit";
if ($action=="edit") {
$user_event_meta = Events\get_event_registration($_GET['event_id'], $_GET['uid']);
} else {
$user_event_meta = Array();
}
$post = Events\get_event($_GET['event_id']);
$show_dietary = get_post_meta($post->ID, 'show_dietary', true);
$session_description = get_post_meta($post->ID, 'session_description', true);
$session_one = get_post_meta($post->ID, 'session_one', true);
$session_two = get_post_meta($post->ID, 'session_two', true);
$session_three = get_post_meta($post->ID, 'session_three', true);
$session_four = get_post_meta($post->ID, 'session_four', true);
$session_five = get_post_meta($post->ID, 'session_five', true);
$session_six = get_post_meta($post->ID, 'session_six', true);
$session_seven = get_post_meta($post->ID, 'session_seven', true);
$session_eight = get_post_meta($post->ID, 'session_eight', true);
$session_nine = get_post_meta($post->ID, 'session_nine', true);
$session_ten = get_post_meta($post->ID, 'session_ten', true);
$mealopt_description = get_post_meta($post->ID, 'mealopt_description', true);
$mealopt_one = get_post_meta($post->ID, 'mealopt_one', true);
$mealopt_two = get_post_meta($post->ID, 'mealopt_two', true);
$mealopt_three = get_post_meta($post->ID, 'mealopt_three', true);
$mealopt_four = get_post_meta($post->ID, 'mealopt_four', true);
$mealopt_five = get_post_meta($post->ID, 'mealopt_five', true);
$mealopt_six = get_post_meta($post->ID, 'mealopt_six', true);
$mealopt_seven = get_post_meta($post->ID, 'mealopt_seven', true);
$mealopt_eight = get_post_meta($post->ID, 'mealopt_eight', true);
$mealopt_nine = get_post_meta($post->ID, 'mealopt_nine', true);
$mealopt_ten = get_post_meta($post->ID, 'mealopt_ten', true);
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'edit_event.php');
$content = ob_get_contents();
ob_end_clean();
die($content);
}
public static function admin_menu() {
add_menu_page('CBV Users','CBV Users',CAPABILITY,'cbv_users',__NAMESPACE__ . '\display_users',null,3 );
add_submenu_page('cbv_users','New User', 'New User',CAPABILITY,'cbv_users_create',__NAMESPACE__ . '\create_user');
}
public static function admin_init() {
register_setting(OPTION_NAME, OPTION_NAME);
}
}
class Vars {
public static $validation;
}
?>