Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MZAWeb
Copy link
Collaborator

@MZAWeb MZAWeb commented Mar 19, 2013

Added the functionality to let the user select what fields to export, with memory so it's easier next time.

* 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' );
Copy link
Owner

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 :))

Copy link
Collaborator Author

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.

@sorich87
Copy link
Owner

Thanks for this pull request! I added you as a collaborator so that you can commit without waiting for me.

@MZAWeb
Copy link
Collaborator Author

MZAWeb commented Mar 20, 2013

Thanks for adding me! Will fix the few comments above this week and then merge the changes.

@MZAWeb
Copy link
Collaborator Author

MZAWeb commented Mar 20, 2013

I'm closing this pull request. Will create a new one and merge it when I fix the remaining issues

@MZAWeb MZAWeb closed this Mar 20, 2013
@sorich87
Copy link
Owner

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 ) );
Copy link
Owner

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?

Copy link
Collaborator Author

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?

Copy link
Owner

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.

@sorich87
Copy link
Owner

sorich87 commented Apr 5, 2013

How is it going?

@sorich87
Copy link
Owner

sorich87 commented Apr 5, 2013

I'm reopening it as a reminder.

@sorich87 sorich87 reopened this Apr 5, 2013
@MZAWeb
Copy link
Collaborator Author

MZAWeb commented Apr 7, 2013

Hey, didn't get to work on this project in the last few days. Next week I'll probably come back to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants