7
7
use q \eud \plugin ;
8
8
use q \eud \core \helper as h ;
9
9
use q \eud \core \user as user ;
10
- // use q\eud\core\buddypress as buddypress;
11
10
use q \eud \api \admin as api_admin ;
12
11
13
12
class render {
@@ -74,28 +73,15 @@ public function admin_page(){
74
73
75
74
}
76
75
77
- // clean up $save_export ##
78
- // $save_export = \sanitize_text_field( $save_export );
79
-
80
76
// Build array of $options to save and save them ##
81
77
if ( isset ( $ save_export ) ) {
82
78
83
- // h::log( 'user_fields: '. $_POST['user_fields'] );
84
-
85
79
// prepare all array values ##
86
80
$ usermeta =
87
81
isset ( $ _POST ['usermeta ' ] ) ?
88
82
array_map ( 'sanitize_text_field ' ,
89
83
$ _POST ['usermeta ' ] ) :
90
84
'' ;
91
- // $bp_fields =
92
- // isset( $_POST['bp_fields'] ) ?
93
- // array_map( 'sanitize_text_field', $_POST['bp_fields'] ) :
94
- // '' ;
95
- // $bp_fields_update =
96
- // isset( $_POST['bp_fields_update_time'] ) ?
97
- // array_map( 'sanitize_text_field', $_POST['bp_fields_update_time'] ) :
98
- // '' ;
99
85
$ format =
100
86
isset ( $ _POST ['format ' ] ) ?
101
87
\sanitize_text_field ( $ _POST ['format ' ] ) :
@@ -136,16 +122,10 @@ public function admin_page(){
136
122
isset ( $ _POST ['updated_since_date ' ] ) ?
137
123
\sanitize_text_field ( $ _POST ['updated_since_date ' ] ) :
138
124
'' ;
139
- $ field_updated_since =
140
- isset ( $ _POST ['bp_field_updated_since ' ] ) ?
141
- array_map ( 'sanitize_text_field ' , $ _POST ['bp_field_updated_since ' ] ) :
142
- '' ;
143
125
144
126
// assign all values to an array ##
145
127
$ save_array = array (
146
128
'usermeta_saved_fields ' => $ usermeta ,
147
- // 'bp_fields_saved_fields' => $bp_fields,
148
- // 'bp_fields_update_time_saved_fields' => $bp_fields_update,
149
129
'role ' => $ role ,
150
130
'roles ' => $ roles ,
151
131
'user_fields ' => $ user_fields ,
@@ -155,7 +135,6 @@ public function admin_page(){
155
135
'limit_offset ' => $ limit_offset ,
156
136
'limit_total ' => $ limit_total ,
157
137
'updated_since_date ' => $ updated_since_date ,
158
- 'field_updated_since ' => $ field_updated_since ,
159
138
'format ' => $ format
160
139
);
161
140
@@ -217,7 +196,6 @@ public function admin_page(){
217
196
$ _limit_total = $ this ->plugin ->get ( '_limit_total ' );
218
197
$ _updated_since_date = $ this ->plugin ->get ( '_updated_since_date ' );
219
198
$ _format = $ this ->plugin ->get ( '_format ' );
220
- $ _field_updated_since = $ this ->plugin ->get ( '_field_updated_since ' );
221
199
$ _updated_since_date = $ this ->plugin ->get ( '_updated_since_date ' );
222
200
223
201
?>
@@ -238,22 +216,15 @@ public function admin_page(){
238
216
// run Query ##
239
217
$ meta_keys = $ wpdb ->get_results ( $ meta_keys_sql );
240
218
241
- // filterable sort ##
242
- // \apply_filters(
243
- // 'q/eud/admin/sort',
244
- asort ( $ meta_keys );
245
- // );
219
+ // sort ##
220
+ asort ( $ meta_keys );
246
221
247
222
// get meta_key value from object ##
248
223
$ meta_keys = \wp_list_pluck ( $ meta_keys , 'meta_key ' );
249
224
250
225
// allow array to be filtered ##
251
226
$ meta_keys_common = \apply_filters ( 'q/eud/admin/meta_keys_common ' , [] );
252
227
253
- // test array ##
254
- #helper::log( $meta_keys );
255
- #helper::log( $meta_keys_common );
256
-
257
228
// check if we got anything ? ##
258
229
if ( $ meta_keys ) {
259
230
@@ -282,18 +253,12 @@ public function admin_page(){
282
253
283
254
foreach ( $ meta_keys_common as $ drop ) {
284
255
285
- #helper::log( 'Checking: '.$drop );
286
-
287
256
if ( strpos ( $ key , $ drop ) !== false ) {
288
257
289
- #helper::log( 'Checking: '.$key );
290
-
291
258
// https://wordpress.org/support/topic/bugfix-numbers-in-export-headers?replies=1
292
259
// removed $key = assignment, as not required ##
293
260
if ( ( array_search ( $ key , $ meta_keys ) ) !== false ) {
294
261
295
- #helper::log( 'Found: '.$key );
296
-
297
262
$ usermeta_class = 'common ' ;
298
263
299
264
}
@@ -323,100 +288,13 @@ public function admin_page(){
323
288
324
289
} // meta_keys found ##
325
290
326
- ?>
327
- <?php
328
-
329
- /*
330
- // buddypress x profile data ##
331
- if ( $bp_fields = buddypress::get_fields() ) {
332
-
333
- ?>
334
- <tr valign="top">
335
- <th scope="row">
336
- <label for="q_eud_xprofile"><?php \_e( 'BP xProfile Fields', 'q-export-user-data' ); ?></label>
337
- <p class="filter" style="margin: 10px 0 0;">
338
- <?php \_e('Select', 'q-export-user-data'); ?>: <a href="#" class="select-all"><?php \_e('All', 'q-export-user-data'); ?></a> | <a href="#" class="select-none"><?php \_e('None', 'q-export-user-data'); ?></a>
339
- </p>
340
- </th>
341
- <td>
342
- <select multiple="multiple" id="bp_fields" name="bp_fields[]">
343
- <?php
344
-
345
- foreach ( $bp_fields as $key ) {
346
-
347
- // print key ##
348
- echo "<option value='".\esc_attr( $key )."' title='".\esc_attr( $key )."'>$key</option>";
349
-
350
- }
351
-
352
- ?>
353
- </select>
354
- <p class="description"><?php
355
- printf(
356
- \__( 'Select the BuddyPress XProfile keys to export', 'q-export-user-data' )
357
- );
358
- ?></p>
359
- </td>
360
- </tr>
361
- <?php
362
-
363
- // allow export of update times ##
364
-
365
- ?>
366
- <tr valign="top" class="toggleable">
367
- <th scope="row">
368
- <label for="q_eud_xprofile"><?php \_e( 'BP xProfile Fields Update Time', 'q-export-user-data' ); ?></label>
369
- <p class="filter" style="margin: 10px 0 0;">
370
- <?php \_e('Select', 'q-export-user-data'); ?>: <a href="#" class="select-all"><?php \_e('All', 'q-export-user-data'); ?></a> | <a href="#" class="select-none"><?php _e('None', 'q-export-user-data'); ?></a>
371
- </p>
372
- </th>
373
- <td>
374
- <select multiple="multiple" id="bp_fields_update_time" name="bp_fields_update_time[]">
375
- <?php
376
-
377
- foreach ( $bp_fields as $key ) {
378
-
379
- echo "<option value='".\esc_attr( $key )."' title='".\esc_attr( $key )."'>$key</option>";
380
-
381
- }
382
-
383
- ?>
384
- </select>
385
- <p class="description"><?php
386
- printf(
387
- \__( 'Select the BuddyPress XProfile keys updated dates to export', 'q-export-user-data' )
388
- );
389
- ?></p>
390
- </td>
391
- </tr>
392
-
393
- <tr valign="top" class="toggleable">
394
- <th scope="row"><label for="groups"><?php \_e( 'BP User Groups', 'q-export-user-data' ); ?></label></th>
395
- <td>
396
- <input id='groups' type='checkbox' name='groups' value='1' <?php \checked( isset ( $_groups ) ? intval ( $_groups ) : '', 1 ); ?> />
397
- <p class="description"><?php
398
- printf(
399
- \__( 'Include BuddyPress Group Data. <a href="%s" target="_blank">%s</a>', 'q-export-user-data' )
400
- , \esc_html('https://codex.buddypress.org/buddypress-components-and-features/groups/')
401
- , 'Codex'
402
- );
403
- ?></p>
404
- </td>
405
- </tr>
406
- <?php
407
-
408
- } // BP installed and active ##
409
- */
410
-
411
291
?>
412
292
<tr valign="top" class="toggleable">
413
293
<th scope="row"><label for="user_fields"><?php \_e ( 'Standard User Fields ' , 'q-export-user-data ' ); ?> </label></th>
414
294
<td>
415
295
<input id='user_fields' type='checkbox' name='user_fields' value='1' <?php \checked ( isset ( $ _user_fields ) ? intval ( $ _user_fields ) : '' , 1 ); ?> />
416
296
<p class="description"><?php
417
297
418
- #h::log( 'user_fields: '.$_user_fields );
419
-
420
298
printf (
421
299
\__ ( 'Include Standard user profile fields, such as user_login. <a href="%s" target="_blank">%s</a> ' , 'q-export-user-data ' )
422
300
, \esc_url ('https://codex.wordpress.org/Database_Description#Table:_wp_users ' )
@@ -506,64 +384,23 @@ public function admin_page(){
506
384
?> </p>
507
385
</td>
508
386
</tr>
509
- <?php
387
+ <?php
510
388
511
- // buddypress x profile data ##
512
- /*
513
- if ( $bp_fields = buddypress::get_fields() ) {
514
-
515
- ?>
516
- <tr valign="top" class="toggleable">
517
- <th scope="row"><label><?php \_e( 'Updated Since', 'q-export-user-data' ); ?></label></th>
518
- <td>
519
- <input type="text" id="q_eud_updated_since_date" name="updated_since_date" value="<?php echo $_updated_since_date; ?>" class="updated-datepicker" />
520
- <select id="bp_field_updated_since" name="bp_field_updated_since">
521
- <?php
389
+ // pull in extra export options from api ##
390
+ if ( $ api_fields = \apply_filters ( 'q/eud/api/admin/fields ' , [] ) ) {
522
391
523
- foreach ( $bp_fields as $key ) {
524
-
525
- if ( $_field_updated_since == $key ) {
526
-
527
- echo "<option value='".\esc_attr( $key )."' title='".\esc_attr( $key )."' selected>$key</option>";
528
-
529
- } else {
530
-
531
- echo "<option value='".\esc_attr( $key )."' title='".\esc_attr( $key )."'>$key</option>";
532
-
533
- }
392
+ // create api instance #
393
+ $ api_admin = new \q \eud \api \admin ();
394
+
395
+ foreach ( $ api_fields as $ field ) {
396
+
397
+ $ api_admin ->render ( $ field );
534
398
535
- }
399
+ }
536
400
537
- ?>
538
- </select>
401
+ }
539
402
540
- <p class="description"><?php
541
- printf(
542
- \__( 'Limit the results to users who have updated this extended profile field after this date.', 'q-export-user-data' )
543
- );
544
- ?></p>
545
- </td>
546
- </tr>
547
- <?php
548
-
549
- } // bp date ##
550
- */
551
-
552
- // pull in extra export options from api ##
553
- if ( $ api_fields = \apply_filters ( 'q/eud/api/admin/fields ' , [] ) ) {
554
-
555
- // create api instance #
556
- $ api_admin = new \q \eud \api \admin ();
557
-
558
- foreach ( $ api_fields as $ field ) {
559
-
560
- $ api_admin ->render ( $ field );
561
-
562
- }
563
-
564
- }
565
-
566
- ?>
403
+ ?>
567
404
<tr valign="top">
568
405
<th scope="row"><label for="q_eud_users_format"><?php \_e ( 'Format ' , 'q-export-user-data ' ); ?> </label></th>
569
406
<td>
@@ -740,7 +577,6 @@ public function jquery():void
740
577
if ( ! is_array ( $ _usermeta_saved_fields ) ) {
741
578
$ _usermeta_saved_fields = [];
742
579
}
743
- // h::log( $_usermeta_saved_fields );
744
580
745
581
?>
746
582
<script>
@@ -820,7 +656,7 @@ public function jquery():void
820
656
821
657
if ( ! q_eud_save_options_new_export || q_eud_save_options_new_export == '' ) {
822
658
823
- e.preventDefault(); // stop things here ##
659
+ e.preventDefault();
824
660
jQuery('#q_eud_save_options_new_export').addClass("error");
825
661
826
662
}
@@ -841,7 +677,6 @@ public function jquery():void
841
677
// get date format from WP settings #
842
678
$ date_format = 'yy-mm-dd ' ; // get_option('date_format') ? get_option('date_format') : 'yy-mm-dd' ;
843
679
$ start_of_week = \get_option ('start_of_week ' ) ? \get_option ('start_of_week ' ) : 'yy-mm-dd ' ;
844
- #self::log( 'Date format: '.$date_format );
845
680
846
681
?>
847
682
// start date picker ##
0 commit comments