77use q \eud \plugin ;
88use q \eud \core \helper as h ;
99use q \eud \core \user as user ;
10- // use q\eud\core\buddypress as buddypress;
1110use q \eud \api \admin as api_admin ;
1211
1312class render {
@@ -74,28 +73,15 @@ public function admin_page(){
7473
7574 }
7675
77- // clean up $save_export ##
78- // $save_export = \sanitize_text_field( $save_export );
79-
8076 // Build array of $options to save and save them ##
8177 if ( isset ( $ save_export ) ) {
8278
83- // h::log( 'user_fields: '. $_POST['user_fields'] );
84-
8579 // prepare all array values ##
8680 $ usermeta =
8781 isset ( $ _POST ['usermeta ' ] ) ?
8882 array_map ( 'sanitize_text_field ' ,
8983 $ _POST ['usermeta ' ] ) :
9084 '' ;
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- // '' ;
9985 $ format =
10086 isset ( $ _POST ['format ' ] ) ?
10187 \sanitize_text_field ( $ _POST ['format ' ] ) :
@@ -136,16 +122,10 @@ public function admin_page(){
136122 isset ( $ _POST ['updated_since_date ' ] ) ?
137123 \sanitize_text_field ( $ _POST ['updated_since_date ' ] ) :
138124 '' ;
139- $ field_updated_since =
140- isset ( $ _POST ['bp_field_updated_since ' ] ) ?
141- array_map ( 'sanitize_text_field ' , $ _POST ['bp_field_updated_since ' ] ) :
142- '' ;
143125
144126 // assign all values to an array ##
145127 $ save_array = array (
146128 'usermeta_saved_fields ' => $ usermeta ,
147- // 'bp_fields_saved_fields' => $bp_fields,
148- // 'bp_fields_update_time_saved_fields' => $bp_fields_update,
149129 'role ' => $ role ,
150130 'roles ' => $ roles ,
151131 'user_fields ' => $ user_fields ,
@@ -155,7 +135,6 @@ public function admin_page(){
155135 'limit_offset ' => $ limit_offset ,
156136 'limit_total ' => $ limit_total ,
157137 'updated_since_date ' => $ updated_since_date ,
158- 'field_updated_since ' => $ field_updated_since ,
159138 'format ' => $ format
160139 );
161140
@@ -217,7 +196,6 @@ public function admin_page(){
217196 $ _limit_total = $ this ->plugin ->get ( '_limit_total ' );
218197 $ _updated_since_date = $ this ->plugin ->get ( '_updated_since_date ' );
219198 $ _format = $ this ->plugin ->get ( '_format ' );
220- $ _field_updated_since = $ this ->plugin ->get ( '_field_updated_since ' );
221199 $ _updated_since_date = $ this ->plugin ->get ( '_updated_since_date ' );
222200
223201?>
@@ -238,22 +216,15 @@ public function admin_page(){
238216 // run Query ##
239217 $ meta_keys = $ wpdb ->get_results ( $ meta_keys_sql );
240218
241- // filterable sort ##
242- // \apply_filters(
243- // 'q/eud/admin/sort',
244- asort ( $ meta_keys );
245- // );
219+ // sort ##
220+ asort ( $ meta_keys );
246221
247222 // get meta_key value from object ##
248223 $ meta_keys = \wp_list_pluck ( $ meta_keys , 'meta_key ' );
249224
250225 // allow array to be filtered ##
251226 $ meta_keys_common = \apply_filters ( 'q/eud/admin/meta_keys_common ' , [] );
252227
253- // test array ##
254- #helper::log( $meta_keys );
255- #helper::log( $meta_keys_common );
256-
257228 // check if we got anything ? ##
258229 if ( $ meta_keys ) {
259230
@@ -282,18 +253,12 @@ public function admin_page(){
282253
283254 foreach ( $ meta_keys_common as $ drop ) {
284255
285- #helper::log( 'Checking: '.$drop );
286-
287256 if ( strpos ( $ key , $ drop ) !== false ) {
288257
289- #helper::log( 'Checking: '.$key );
290-
291258 // https://wordpress.org/support/topic/bugfix-numbers-in-export-headers?replies=1
292259 // removed $key = assignment, as not required ##
293260 if ( ( array_search ( $ key , $ meta_keys ) ) !== false ) {
294261
295- #helper::log( 'Found: '.$key );
296-
297262 $ usermeta_class = 'common ' ;
298263
299264 }
@@ -323,100 +288,13 @@ public function admin_page(){
323288
324289 } // meta_keys found ##
325290
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-
411291?>
412292 <tr valign="top" class="toggleable">
413293 <th scope="row"><label for="user_fields"><?php \_e ( 'Standard User Fields ' , 'q-export-user-data ' ); ?> </label></th>
414294 <td>
415295 <input id='user_fields' type='checkbox' name='user_fields' value='1' <?php \checked ( isset ( $ _user_fields ) ? intval ( $ _user_fields ) : '' , 1 ); ?> />
416296 <p class="description"><?php
417297
418- #h::log( 'user_fields: '.$_user_fields );
419-
420298 printf (
421299 \__ ( 'Include Standard user profile fields, such as user_login. <a href="%s" target="_blank">%s</a> ' , 'q-export-user-data ' )
422300 , \esc_url ('https://codex.wordpress.org/Database_Description#Table:_wp_users ' )
@@ -506,64 +384,23 @@ public function admin_page(){
506384 ?> </p>
507385 </td>
508386 </tr>
509- <?php
387+ <?php
510388
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 ' , [] ) ) {
522391
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 );
534398
535- }
399+ }
536400
537- ?>
538- </select>
401+ }
539402
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+ ?>
567404 <tr valign="top">
568405 <th scope="row"><label for="q_eud_users_format"><?php \_e ( 'Format ' , 'q-export-user-data ' ); ?> </label></th>
569406 <td>
@@ -740,7 +577,6 @@ public function jquery():void
740577 if ( ! is_array ( $ _usermeta_saved_fields ) ) {
741578 $ _usermeta_saved_fields = [];
742579 }
743- // h::log( $_usermeta_saved_fields );
744580
745581?>
746582 <script>
@@ -820,7 +656,7 @@ public function jquery():void
820656
821657 if ( ! q_eud_save_options_new_export || q_eud_save_options_new_export == '' ) {
822658
823- e.preventDefault(); // stop things here ##
659+ e.preventDefault();
824660 jQuery('#q_eud_save_options_new_export').addClass("error");
825661
826662 }
@@ -841,7 +677,6 @@ public function jquery():void
841677 // get date format from WP settings #
842678 $ date_format = 'yy-mm-dd ' ; // get_option('date_format') ? get_option('date_format') : 'yy-mm-dd' ;
843679 $ start_of_week = \get_option ('start_of_week ' ) ? \get_option ('start_of_week ' ) : 'yy-mm-dd ' ;
844- #self::log( 'Date format: '.$date_format );
845680
846681 ?>
847682 // start date picker ##
0 commit comments