New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/fields selector #1
base: master
Are you sure you want to change the base?
Conversation
* Add checkboxes so the user can select which fields he wants to export * Modify CSV generator to use fputcsv instead of the manual way
$data_keys = array( 'ID', 'user_login', 'user_pass', 'user_nicename', 'user_email', 'user_url', 'user_registered', 'user_activation_key', 'user_status', 'display_name' ); | ||
|
||
$meta_keys = $wpdb->get_results( "SELECT distinct(meta_key) FROM $wpdb->usermeta" ); | ||
$meta_keys = wp_list_pluck( $meta_keys, 'meta_key' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the two lines above be replaced by a $wpdb->get_col? (I'm not sure myself, just asking :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally! Will do. Good catch.
Thanks for this pull request! I added you as a collaborator so that you can commit without waiting for me. |
Thanks for adding me! Will fix the few comments above this week and then merge the changes. |
I'm closing this pull request. Will create a new one and merge it when I fix the remaining issues |
That's great. Thanks! I really appreciate your contribution. |
<fieldset id="pp_eu_users_fields_wrapper"> | ||
<?php | ||
foreach ( $fields as $field ) { | ||
echo sprintf( '<label for="pp_eu_field_%1$s"><input type="checkbox" name="pp_eu_users_fields[]" id="pp_eu_field_%1$s" %2$s value="%1$s"> %3$s</label><br/>', esc_attr( $field ), checked( in_array( $field, $selected ), true, false ), esc_html( $field ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if using checkboxes is good for websites where there are dozens of fields. Maybe using a multi-select with a library like (http://harvesthq.github.com/chosen/)[Chosen] is a solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checkbox was enough for the project I'm working on. I think it's a good idea to switch to a more powerful solution. Personally, I prefer Select2 over Chosen. Maybe for 1.0.1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, feel free to use Select2 instead.
How is it going? |
I'm reopening it as a reminder. |
Hey, didn't get to work on this project in the last few days. Next week I'll probably come back to it. |
Added the functionality to let the user select what fields to export, with memory so it's easier next time.