Export User Data - Version 0.6.3

Version Description

  • added multiselect to pick usermeta and xprofile fields
Download this release

Release Info

Developer qlstudio
Plugin Icon wp plugin Export User Data
Version 0.6.3
Comparing to
See all releases

Code changes from version 0.6.1 to 0.6.3

css/multi-select.css ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ms-container{
2
+ background: transparent url('../img/switch.png') no-repeat 50% 50%;
3
+ width: 600px;
4
+ }
5
+
6
+ .ms-container:after{
7
+ content: ".";
8
+ display: block;
9
+ height: 0;
10
+ line-height: 0;
11
+ font-size: 0;
12
+ clear: both;
13
+ min-height: 0;
14
+ visibility: hidden;
15
+ }
16
+
17
+ .ms-container .ms-selectable, .ms-container .ms-selection{
18
+ background: #fff;
19
+ color: #555555;
20
+ float: left;
21
+ width: 45%;
22
+ }
23
+
24
+ .ms-container .ms-list{
25
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
26
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
27
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
28
+ -webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
29
+ -moz-transition: border linear 0.2s, box-shadow linear 0.2s;
30
+ -ms-transition: border linear 0.2s, box-shadow linear 0.2s;
31
+ -o-transition: border linear 0.2s, box-shadow linear 0.2s;
32
+ transition: border linear 0.2s, box-shadow linear 0.2s;
33
+ border: 1px solid #ccc;
34
+ -webkit-border-radius: 3px;
35
+ -moz-border-radius: 3px;
36
+ border-radius: 3px;
37
+ position: relative;
38
+ height: 200px;
39
+ padding: 0;
40
+ overflow-y: auto;
41
+ }
42
+
43
+ .ms-container .ms-selectable{
44
+ margin-right: 10%;
45
+ }
46
+
47
+ .ms-container .ms-list.ms-focus{
48
+ border-color: rgba(82, 168, 236, 0.8);
49
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
50
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
51
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
52
+ outline: 0;
53
+ outline: thin dotted \9;
54
+ }
55
+
56
+ .ms-container ul{
57
+ margin: 0;
58
+ list-style-type: none;
59
+ padding: 0;
60
+ }
61
+
62
+ .ms-container .ms-optgroup-container{
63
+ width: 100%;
64
+ }
65
+
66
+ .ms-container .ms-optgroup-label{
67
+ margin: 0;
68
+ padding: 5px 0px 0px 5px;
69
+ cursor: pointer;
70
+ color: #999;
71
+ }
72
+
73
+ .ms-container .ms-selectable li.ms-elem-selectable,
74
+ .ms-container .ms-selection li.ms-elem-selection{
75
+ border-bottom: 1px #eee solid;
76
+ padding: 4px 10px;
77
+ color: #555;
78
+ font-size: 14px;
79
+ margin-bottom: 0px;
80
+ }
81
+
82
+ .ms-container .ms-selectable li.ms-hover,
83
+ .ms-container .ms-selection li.ms-hover{
84
+ cursor: pointer;
85
+ color: #fff;
86
+ text-decoration: none;
87
+ background-color: #08c;
88
+ margin-bottom: 0px;
89
+ }
90
+
91
+ .ms-container .ms-selectable li.disabled,
92
+ .ms-container .ms-selection li.disabled{
93
+ background-color: #eee;
94
+ color: #aaa;
95
+ cursor: text;
96
+ margin-bottom: 0px;
97
+ }
export-user-data.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * @package Export_User_Data
4
- * @version 0.6.1
5
  */
6
  /*
7
  Plugin Name: Export User Data
8
  Plugin URI: http://qstudio.us/plugins/
9
  Description: Export User data, metadata and BuddyPressX Profile data.
10
- Version: 0.6.1
11
  Author: Q Studio
12
  Author URI: http://qstudio.us/
13
  License: GPL2
@@ -33,20 +33,33 @@ class Q_EUD_Export_Users {
33
  * @since 0.1
34
  **/
35
  public function __construct() {
36
- add_action( 'admin_menu', array( $this, 'add_admin_pages' ) );
37
- add_action( 'init', array( $this, 'generate_data' ) );
38
- add_filter( 'q_eud_exclude_data', array( $this, 'exclude_data' ) );
 
 
39
  }
40
 
41
- /**
 
42
  * Add administration menus
43
  *
44
  * @since 0.1
45
  **/
46
  public function add_admin_pages() {
47
- add_users_page( __( 'Export User Data', 'export-user-data' ), __( 'Export User Data', 'export-user-data' ), 'list_users', 'export-user-data', array( $this, 'users_page' ) );
 
48
  }
 
 
 
 
 
 
 
 
49
 
 
50
  /* clean that stuff up ## */
51
  public function sanitize($value) {
52
  $value = str_replace("\r", '', $value);
@@ -55,6 +68,30 @@ class Q_EUD_Export_Users {
55
  return $value;
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  /**
59
  * Process content of CSV file
60
  *
@@ -147,17 +184,6 @@ class Q_EUD_Export_Users {
147
  $usermeta_fields[] = $field;
148
  }
149
 
150
- // array of usermeta fields to include ##
151
- /*
152
- $usermeta_fields = array(
153
- 'member_of_club', // program ID ##
154
- 'last_activity', // last BP activity ##
155
- 'q_api_u_key', // Adage registration key ##
156
- 'rewards_milestone', // if reward milestone reached ##
157
- 'total_friend_count', // BP friend count ##
158
- );
159
- */
160
-
161
  // check for selected x profile fields ##
162
  $bp_fields = $_POST['bp_fields'];
163
  $bp_fields_passed = array();
@@ -174,7 +200,7 @@ class Q_EUD_Export_Users {
174
  // global wpdb object ##
175
  global $wpdb;
176
 
177
- // requested user data ##
178
  $data_keys = array(
179
  'ID', 'user_login', 'user_pass',
180
  'user_nicename', 'user_email', 'user_url',
@@ -284,8 +310,8 @@ class Q_EUD_Export_Users {
284
  // get meta_key value from object ##
285
  $meta_keys = wp_list_pluck( $meta_keys, 'meta_key' );
286
 
287
- // let's ditch some of them odd keys ##
288
- $meta_keys_drop = array(
289
  'metaboxhidden',
290
  'activation',
291
  'bp_',
@@ -313,11 +339,12 @@ class Q_EUD_Export_Users {
313
  );
314
 
315
  // allow array to be filtered ##
316
- $meta_keys_drop = apply_filters( 'export_user_data_meta_keys_drop', $meta_keys_drop );
317
-
 
318
  foreach ( $meta_keys as $key ) {
319
 
320
- foreach ( $meta_keys_drop as $drop ) {
321
 
322
  if ( strpos( $key, $drop ) !== false ) {
323
 
@@ -332,6 +359,7 @@ class Q_EUD_Export_Users {
332
  }
333
 
334
  }
 
335
 
336
  // test array ##
337
  #echo '<pre>'; var_dump($meta_keys); echo '</pre>';
@@ -341,28 +369,58 @@ class Q_EUD_Export_Users {
341
 
342
  ?>
343
  <tr valign="top">
344
- <th scope="row"><label for="q_eud_usermeta"><?php _e( 'User Meta Fields', 'export-user-data' ); ?></label></th>
 
 
 
 
 
345
  <td>
346
- <?php
347
-
348
- foreach ( $meta_keys as $key ) {
349
-
350
- #echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
351
-
352
- // display $key ##
353
- $display_key = $key;
354
-
355
- // rename programs field ##
356
- if ( $display_key == 'member_of_club' ){
357
- $display_key = 'program';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  }
359
-
360
- // tidy ##
361
- $display_key = str_replace( "_", " ", ucwords($display_key) );
362
-
363
- echo "<label for='".esc_attr( $key )."' title='".esc_attr( $key )."'><input id='".esc_attr( $key )."' type='checkbox' name='usermeta[]' value='".esc_attr( $key )."'/> $display_key</label><br />";
364
- }
365
- ?>
366
  </td>
367
  </tr>
368
  <?php
@@ -391,6 +449,7 @@ class Q_EUD_Export_Users {
391
  <tr valign="top">
392
  <th scope="row"><label for="q_eud_xprofile"><?php _e( 'BP xProfile Fields', 'export-user-data' ); ?></label></th>
393
  <td>
 
394
  <?php
395
 
396
  foreach ( $bp_fields as $key ) {
@@ -398,9 +457,14 @@ class Q_EUD_Export_Users {
398
  // tidy up key ##
399
  $key_tidy = str_replace( ' ', '__', ($key));
400
 
401
- echo "<label for='".esc_attr( $key_tidy )."'><input id='".esc_attr( $key_tidy )."' type='checkbox' name='bp_fields[]' value='".esc_attr( $key_tidy )."'/> $key</label><br />";
 
 
 
 
402
  }
403
  ?>
 
404
  </td>
405
  </tr>
406
  <?php
1
  <?php
2
  /**
3
  * @package Export_User_Data
4
+ * @version 0.6.3
5
  */
6
  /*
7
  Plugin Name: Export User Data
8
  Plugin URI: http://qstudio.us/plugins/
9
  Description: Export User data, metadata and BuddyPressX Profile data.
10
+ Version: 0.6.3
11
  Author: Q Studio
12
  Author URI: http://qstudio.us/
13
  License: GPL2
33
  * @since 0.1
34
  **/
35
  public function __construct() {
36
+ add_action( 'admin_menu', array( $this, 'add_admin_pages' ) );
37
+ add_action( 'init', array( $this, 'generate_data' ) );
38
+ add_filter( 'q_eud_exclude_data', array( $this, 'exclude_data' ) );
39
+ add_action( 'admin_init', array( $this, 'add_css_and_js' ) );
40
+ add_action( 'admin_footer', array( $this, 'multiselect' ), 100000 );
41
  }
42
 
43
+
44
+ /**
45
  * Add administration menus
46
  *
47
  * @since 0.1
48
  **/
49
  public function add_admin_pages() {
50
+ add_users_page( __( 'Export User Data', 'export-user-data' ), __( 'Export User Data', 'export-user-data' ), 'list_users', 'export-user-data', array( $this, 'users_page' ) );
51
+ #add_action( 'admin_footer-'. $plugin_page, 'multiselect' );
52
  }
53
+
54
+
55
+ /* style and interaction */
56
+ function add_css_and_js() {
57
+ wp_register_style('q_eud_multi_select_css', plugins_url('css/multi-select.css',__FILE__ ));
58
+ wp_enqueue_style('q_eud_multi_select_css');
59
+ wp_enqueue_script('q_eud_multi_select_js', plugins_url('js/jquery.multi-select.js',__FILE__ ), array('jquery'), '0.9.8', false );
60
+ }
61
 
62
+
63
  /* clean that stuff up ## */
64
  public function sanitize($value) {
65
  $value = str_replace("\r", '', $value);
68
  return $value;
69
  }
70
 
71
+
72
+ /* activate multiselects */
73
+ function multiselect() {
74
+ ?>
75
+ <script>
76
+ // build super multiselect ##
77
+ jQuery('#usermeta, #bp_fields').multiSelect();
78
+
79
+ // show only common ##
80
+ jQuery('.usermeta-common').click(function(e){
81
+ e.preventDefault();
82
+ jQuery('#ms-usermeta .ms-selectable li.system').hide();
83
+ });
84
+
85
+ // show all ##
86
+ jQuery('.usermeta-all').click(function(e){
87
+ e.preventDefault();
88
+ jQuery('#ms-usermeta .ms-selectable li').show();
89
+ });
90
+
91
+ </script>
92
+ <?php
93
+ }
94
+
95
  /**
96
  * Process content of CSV file
97
  *
184
  $usermeta_fields[] = $field;
185
  }
186
 
 
 
 
 
 
 
 
 
 
 
 
187
  // check for selected x profile fields ##
188
  $bp_fields = $_POST['bp_fields'];
189
  $bp_fields_passed = array();
200
  // global wpdb object ##
201
  global $wpdb;
202
 
203
+ // exportable user data ##
204
  $data_keys = array(
205
  'ID', 'user_login', 'user_pass',
206
  'user_nicename', 'user_email', 'user_url',
310
  // get meta_key value from object ##
311
  $meta_keys = wp_list_pluck( $meta_keys, 'meta_key' );
312
 
313
+ // let's note some of them odd keys ##
314
+ $meta_keys_system = array(
315
  'metaboxhidden',
316
  'activation',
317
  'bp_',
339
  );
340
 
341
  // allow array to be filtered ##
342
+ $meta_keys_system = apply_filters( 'export_user_data_meta_keys_system', $meta_keys_system );
343
+
344
+ /*
345
  foreach ( $meta_keys as $key ) {
346
 
347
+ foreach ( $meta_keys_system as $drop ) {
348
 
349
  if ( strpos( $key, $drop ) !== false ) {
350
 
359
  }
360
 
361
  }
362
+ */
363
 
364
  // test array ##
365
  #echo '<pre>'; var_dump($meta_keys); echo '</pre>';
369
 
370
  ?>
371
  <tr valign="top">
372
+ <th scope="row">
373
+ <label for="q_eud_usermeta"><?php _e( 'User Meta Fields', 'export-user-data' ); ?></label>
374
+ <p class="filter" style="margin: 10px 0 0;">
375
+ <?php _e('Filter', 'export-user-data'); ?>: <a href="#" class="usermeta-all"><?php _e('All', 'export-user-data'); ?></a> | <a href="#" class="usermeta-common"><?php _e('Common', 'export-user-data'); ?></a>
376
+ </p>
377
+ </th>
378
  <td>
379
+ <select multiple="multiple" id="usermeta" name="usermeta[]">
380
+ <?php
381
+
382
+ foreach ( $meta_keys as $key ) {
383
+
384
+ #echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
385
+
386
+ // display $key ##
387
+ $display_key = $key;
388
+
389
+ // rename programs field ##
390
+ if ( $display_key == 'member_of_club' ){
391
+ $display_key = 'program';
392
+ }
393
+
394
+ // tidy ##
395
+ $display_key = str_replace( "_", " ", ucwords($display_key) );
396
+
397
+ #echo "<label for='".esc_attr( $key )."' title='".esc_attr( $key )."'><input id='".esc_attr( $key )."' type='checkbox' name='usermeta[]' value='".esc_attr( $key )."'/> $display_key</label><br />";
398
+
399
+ // class ##
400
+ $usermeta_class = 'normal';
401
+
402
+ foreach ( $meta_keys_system as $drop ) {
403
+
404
+ if ( strpos( $key, $drop ) !== false ) {
405
+
406
+ #echo 'FOUND -- '.$drop.' in '.$key.'<br />';
407
+
408
+ if(($key = array_search($key, $meta_keys)) !== false) {
409
+
410
+ $usermeta_class = 'system';
411
+
412
+ }
413
+
414
+ }
415
+
416
+ }
417
+
418
+ // print key ##
419
+ echo "<option value='".esc_attr( $key )."' title='".esc_attr( $key )."' class='".$usermeta_class."'>$display_key</option>";
420
+
421
  }
422
+ ?>
423
+ </select>
 
 
 
 
 
424
  </td>
425
  </tr>
426
  <?php
449
  <tr valign="top">
450
  <th scope="row"><label for="q_eud_xprofile"><?php _e( 'BP xProfile Fields', 'export-user-data' ); ?></label></th>
451
  <td>
452
+ <select multiple="multiple" id="bp_fields" name="bp_fields[]">
453
  <?php
454
 
455
  foreach ( $bp_fields as $key ) {
457
  // tidy up key ##
458
  $key_tidy = str_replace( ' ', '__', ($key));
459
 
460
+ #echo "<label for='".esc_attr( $key_tidy )."'><input id='".esc_attr( $key_tidy )."' type='checkbox' name='bp_fields[]' value='".esc_attr( $key_tidy )."'/> $key</label><br />";
461
+
462
+ // print key ##
463
+ echo "<option value='".esc_attr( $key )."' title='".esc_attr( $key )."'>$key</option>";
464
+
465
  }
466
  ?>
467
+ </select>
468
  </td>
469
  </tr>
470
  <?php
img/switch.png ADDED
Binary file
js/jquery.multi-select.js ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MultiSelect v0.9.8
3
+ * Copyright (c) 2012 Louis Cuny
4
+ *
5
+ * This program is free software. It comes without any warranty, to
6
+ * the extent permitted by applicable law. You can redistribute it
7
+ * and/or modify it under the terms of the Do What The Fuck You Want
8
+ * To Public License, Version 2, as published by Sam Hocevar. See
9
+ * http://sam.zoy.org/wtfpl/COPYING for more details.
10
+ */
11
+
12
+ !function ($) {
13
+
14
+ "use strict";
15
+
16
+
17
+ /* MULTISELECT CLASS DEFINITION
18
+ * ====================== */
19
+
20
+ var MultiSelect = function (element, options) {
21
+ this.options = options;
22
+ this.$element = $(element);
23
+
24
+ this.$container = $('<div/>', { 'class': "ms-container" });
25
+ this.$selectableContainer = $('<div/>', { 'class': 'ms-selectable' });
26
+ this.$selectionContainer = $('<div/>', { 'class': 'ms-selection' });
27
+ this.$selectableUl = $('<ul/>', { 'class': "ms-list", 'tabindex' : '-1' });
28
+ this.$selectionUl = $('<ul/>', { 'class': "ms-list", 'tabindex' : '-1' });
29
+ this.scrollTo = 0;
30
+ this.sanitizeRegexp = new RegExp("\\W+", 'gi');
31
+ this.elemsSelector = 'li:visible:not(.ms-optgroup-label,.ms-optgroup-container,.'+options.disabledClass+')';
32
+ };
33
+
34
+ MultiSelect.prototype = {
35
+ constructor: MultiSelect,
36
+
37
+ init: function(){
38
+ var that = this,
39
+ ms = this.$element;
40
+
41
+ if (ms.next('.ms-container').length === 0){
42
+ ms.css({ position: 'absolute', left: '-9999px' });
43
+ ms.attr('id', ms.attr('id') ? ms.attr('id') : Math.ceil(Math.random()*1000)+'multiselect');
44
+ this.$container.attr('id', 'ms-'+ms.attr('id'));
45
+
46
+ ms.find('option').each(function(){
47
+ that.generateLisFromOption(this);
48
+ });
49
+
50
+ this.$selectionUl.find('.ms-optgroup-label').hide();
51
+
52
+ if (that.options.selectableHeader){
53
+ that.$selectableContainer.append(that.options.selectableHeader);
54
+ }
55
+ that.$selectableContainer.append(that.$selectableUl);
56
+ if (that.options.selectableFooter){
57
+ that.$selectableContainer.append(that.options.selectableFooter);
58
+ }
59
+
60
+ if (that.options.selectionHeader){
61
+ that.$selectionContainer.append(that.options.selectionHeader);
62
+ }
63
+ that.$selectionContainer.append(that.$selectionUl);
64
+ if (that.options.selectionFooter){
65
+ that.$selectionContainer.append(that.options.selectionFooter);
66
+ }
67
+
68
+ that.$container.append(that.$selectableContainer);
69
+ that.$container.append(that.$selectionContainer);
70
+ ms.after(that.$container);
71
+
72
+ that.activeMouse(that.$selectableUl);
73
+ that.activeKeyboard(that.$selectableUl);
74
+
75
+ var action = that.options.dblClick ? 'dblclick' : 'click';
76
+
77
+ that.$selectableUl.on(action, '.ms-elem-selectable', function(){
78
+ that.select($(this).data('ms-value'));
79
+ });
80
+ that.$selectionUl.on(action, '.ms-elem-selection', function(){
81
+ that.deselect($(this).data('ms-value'));
82
+ });
83
+
84
+ that.activeMouse(that.$selectionUl);
85
+ that.activeKeyboard(that.$selectionUl);
86
+
87
+ ms.on('focus', function(){
88
+ that.$selectableUl.focus();
89
+ })
90
+ }
91
+
92
+ var selectedValues = ms.find('option:selected').map(function(){ return $(this).val(); }).get();
93
+ that.select(selectedValues, 'init');
94
+
95
+ if (typeof that.options.afterInit === 'function') {
96
+ that.options.afterInit.call(this, this.$container);
97
+ }
98
+ },
99
+
100
+ 'generateLisFromOption' : function(option){
101
+ var that = this,
102
+ ms = that.$element,
103
+ attributes = "",
104
+ $option = $(option);
105
+
106
+ for (var cpt = 0; cpt < option.attributes.length; cpt++){
107
+ var attr = option.attributes[cpt];
108
+
109
+ if(attr.name !== 'value'){
110
+ attributes += attr.name+'="'+attr.value+'" ';
111
+ }
112
+ }
113
+ var selectableLi = $('<li '+attributes+'><span>'+$option.text()+'</span></li>'),
114
+ selectedLi = selectableLi.clone(),
115
+ value = $option.val(),
116
+ elementId = that.sanitize(value, that.sanitizeRegexp);
117
+
118
+ selectableLi
119
+ .data('ms-value', value)
120
+ .addClass('ms-elem-selectable')
121
+ .attr('id', elementId+'-selectable');
122
+
123
+ selectedLi
124
+ .data('ms-value', value)
125
+ .addClass('ms-elem-selection')
126
+ .attr('id', elementId+'-selection')
127
+ .hide();
128
+
129
+ if ($option.prop('disabled') || ms.prop('disabled')){
130
+ selectedLi.addClass(that.options.disabledClass);
131
+ selectableLi.addClass(that.options.disabledClass);
132
+ }
133
+
134
+ var $optgroup = $option.parent('optgroup');
135
+
136
+ if ($optgroup.length > 0){
137
+ var optgroupLabel = $optgroup.attr('label'),
138
+ optgroupId = that.sanitize(optgroupLabel, that.sanitizeRegexp),
139
+ $selectableOptgroup = that.$selectableUl.find('#optgroup-selectable-'+optgroupId),
140
+ $selectionOptgroup = that.$selectionUl.find('#optgroup-selection-'+optgroupId);
141
+
142
+ if ($selectableOptgroup.length === 0){
143
+ var optgroupContainerTpl = '<li class="ms-optgroup-container"></li>',
144
+ optgroupTpl = '<ul class="ms-optgroup"><li class="ms-optgroup-label"><span>'+optgroupLabel+'</span></li></ul>';
145
+
146
+ $selectableOptgroup = $(optgroupContainerTpl);
147
+ $selectionOptgroup = $(optgroupContainerTpl);
148
+ $selectableOptgroup.attr('id', 'optgroup-selectable-'+optgroupId);
149
+ $selectionOptgroup.attr('id', 'optgroup-selection-'+optgroupId);
150
+ $selectableOptgroup.append($(optgroupTpl));
151
+ $selectionOptgroup.append($(optgroupTpl));
152
+ if (that.options.selectableOptgroup){
153
+ $selectableOptgroup.find('.ms-optgroup-label').on('click', function(){
154
+ var values = $optgroup.children(':not(:selected)').map(function(){ return $(this).val() }).get();
155
+ that.select(values);
156
+ });
157
+ $selectionOptgroup.find('.ms-optgroup-label').on('click', function(){
158
+ var values = $optgroup.children(':selected').map(function(){ return $(this).val() }).get();
159
+ that.deselect(values);
160
+ });
161
+ }
162
+ that.$selectableUl.append($selectableOptgroup);
163
+ that.$selectionUl.append($selectionOptgroup);
164
+ }
165
+ $selectableOptgroup.children().append(selectableLi);
166
+ $selectionOptgroup.children().append(selectedLi);
167
+ } else {
168
+ that.$selectableUl.append(selectableLi);
169
+ that.$selectionUl.append(selectedLi);
170
+ }
171
+ },
172
+
173
+ 'activeKeyboard' : function($list){
174
+ var that = this;
175
+
176
+ $list.on('focus', function(){
177
+ $(this).addClass('ms-focus');
178
+ })
179
+ .on('blur', function(){
180
+ $(this).removeClass('ms-focus');
181
+ })
182
+ .on('keydown', function(e){
183
+ switch (e.which) {
184
+ case 40:
185
+ case 38:
186
+ e.preventDefault();
187
+ e.stopPropagation();
188
+ that.moveHighlight($(this), (e.which === 38) ? -1 : 1);
189
+ return;
190
+ case 32:
191
+ e.preventDefault();
192
+ e.stopPropagation();
193
+ that.selectHighlighted($list);
194
+ return;
195
+ case 37:
196
+ case 39:
197
+ e.preventDefault();
198
+ e.stopPropagation();
199
+ that.switchList($list);
200
+ return;
201
+ }
202
+ });
203
+ },
204
+
205
+ 'moveHighlight': function($list, direction){
206
+ var $elems = $list.find(this.elemsSelector),
207
+ $currElem = $elems.filter('.ms-hover'),
208
+ $nextElem = null,
209
+ elemHeight = $elems.first().outerHeight(),
210
+ containerHeight = $list.height(),
211
+ containerSelector = '#'+this.$container.prop('id');
212
+
213
+ // Deactive mouseenter event when move is active
214
+ // It fixes a bug when mouse is over the list
215
+ $elems.off('mouseenter');
216
+
217
+ $elems.removeClass('ms-hover');
218
+ if (direction === 1){ // DOWN
219
+
220
+ $nextElem = $currElem.nextAll(this.elemsSelector).first();
221
+ if ($nextElem.length === 0){
222
+ var $optgroupUl = $currElem.parent();
223
+
224
+ if ($optgroupUl.hasClass('ms-optgroup')){
225
+ var $optgroupLi = $optgroupUl.parent(),
226
+ $nextOptgroupLi = $optgroupLi.next(':visible');
227
+
228
+ if ($nextOptgroupLi.length > 0){
229
+ $nextElem = $nextOptgroupLi.find(this.elemsSelector).first();
230
+ } else {
231
+ $nextElem = $elems.first();
232
+ }
233
+ } else {
234
+ $nextElem = $elems.first();
235
+ }
236
+ }
237
+ } else if (direction === -1){ // UP
238
+
239
+ $nextElem = $currElem.prevAll(this.elemsSelector).first();
240
+ if ($nextElem.length === 0){
241
+ var $optgroupUl = $currElem.parent();
242
+
243
+ if ($optgroupUl.hasClass('ms-optgroup')){
244
+ var $optgroupLi = $optgroupUl.parent(),
245
+ $prevOptgroupLi = $optgroupLi.prev(':visible');
246
+
247
+ if ($prevOptgroupLi.length > 0){
248
+ $nextElem = $prevOptgroupLi.find(this.elemsSelector).last();
249
+ } else {
250
+ $nextElem = $elems.last();
251
+ }
252
+ } else {
253
+ $nextElem = $elems.last();
254
+ }
255
+ }
256
+ }
257
+ if ($nextElem.length > 0){
258
+ $nextElem.addClass('ms-hover');
259
+ var scrollTo = $list.scrollTop() + $nextElem.position().top -
260
+ containerHeight / 2 + elemHeight / 2;
261
+
262
+ $list.scrollTop(scrollTo);
263
+ }
264
+ },
265
+
266
+ 'selectHighlighted' : function($list){
267
+ var $elems = $list.find(this.elemsSelector),
268
+ $highlightedElem = $elems.filter('.ms-hover').first();
269
+
270
+ if ($highlightedElem.length > 0){
271
+ if ($list.parent().hasClass('ms-selectable')){
272
+ this.select($highlightedElem.data('ms-value'));
273
+ } else {
274
+ this.deselect($highlightedElem.data('ms-value'));
275
+ }
276
+ $elems.removeClass('ms-hover');
277
+ }
278
+ },
279
+
280
+ 'switchList' : function($list){
281
+ $list.blur();
282
+ if ($list.parent().hasClass('ms-selectable')){
283
+ this.$selectionUl.focus();
284
+ } else {
285
+ this.$selectableUl.focus();
286
+ }
287
+ },
288
+
289
+ 'activeMouse' : function($list){
290
+ var that = this;
291
+
292
+ $list.on('mousemove', function(){
293
+ var elems = $list.find(that.elemsSelector);
294
+
295
+ elems.on('mouseenter', function(){
296
+ elems.removeClass('ms-hover');
297
+ $(this).addClass('ms-hover');
298
+ });
299
+ });
300
+ },
301
+
302
+ 'refresh' : function() {
303
+ this.destroy();
304
+ this.$element.multiSelect(this.options);
305
+ },
306
+
307
+ 'destroy' : function(){
308
+ $("#ms-"+this.$element.attr("id")).remove();
309
+ this.$element.removeData('multiselect');
310
+ },
311
+
312
+ 'select' : function(value, method){
313
+ if (typeof value === 'string'){ value = [value]; }
314
+
315
+ var that = this,
316
+ ms = this.$element,
317
+ msIds = $.map(value, function(val){ return(that.sanitize(val, that.sanitizeRegexp)); }),
318
+ selectables = this.$selectableUl.find('#' + msIds.join('-selectable, #')+'-selectable').filter(':not(.'+that.options.disabledClass+')'),
319
+ selections = this.$selectionUl.find('#' + msIds.join('-selection, #') + '-selection').filter(':not(.'+that.options.disabledClass+')'),
320
+ options = ms.find('option:not(:disabled)').filter(function(){ return($.inArray(this.value, value) > -1); });
321
+
322
+ if (selectables.length > 0){
323
+ selectables.addClass('ms-selected').hide();
324
+ selections.addClass('ms-selected').show();
325
+ options.prop('selected', true);
326
+
327
+ var selectableOptgroups = that.$selectableUl.children('.ms-optgroup-container');
328
+ if (selectableOptgroups.length > 0){
329
+ selectableOptgroups.each(function(){
330
+ var selectablesLi = $(this).find('.ms-elem-selectable');
331
+ if (selectablesLi.length === selectablesLi.filter('.ms-selected').length){
332
+ $(this).find('.ms-optgroup-label').hide();
333
+ }
334
+ });
335
+
336
+ var selectionOptgroups = that.$selectionUl.children('.ms-optgroup-container');
337
+ selectionOptgroups.each(function(){
338
+ var selectionsLi = $(this).find('.ms-elem-selection');
339
+ if (selectionsLi.filter('.ms-selected').length > 0){
340
+ $(this).find('.ms-optgroup-label').show();
341
+ }
342
+ });
343
+ } else {
344
+ if (that.options.keepOrder){
345
+ var selectionLiLast = that.$selectionUl.find('.ms-selected');
346
+ if((selectionLiLast.length > 1) && (selectionLiLast.last().get(0) != selections.get(0))) {
347
+ selections.insertAfter(selectionLiLast.last());
348
+ }
349
+ }
350
+ }
351
+ if (method !== 'init'){
352
+ ms.trigger('change');
353
+ if (typeof that.options.afterSelect === 'function') {
354
+ that.options.afterSelect.call(this, value);
355
+ }
356
+ }
357
+ }
358
+ },
359
+
360
+ 'deselect' : function(value){
361
+ if (typeof value === 'string'){ value = [value]; }
362
+
363
+ var that = this,
364
+ ms = this.$element,
365
+ msIds = $.map(value, function(val){ return(that.sanitize(val, that.sanitizeRegexp)); }),
366
+ selectables = this.$selectableUl.find('#' + msIds.join('-selectable, #')+'-selectable'),
367
+ selections = this.$selectionUl.find('#' + msIds.join('-selection, #')+'-selection').filter('.ms-selected'),
368
+ options = ms.find('option').filter(function(){ return($.inArray(this.value, value) > -1); });
369
+
370
+ if (selections.length > 0){
371
+ selectables.removeClass('ms-selected').show();
372
+ selections.removeClass('ms-selected').hide();
373
+ options.prop('selected', false);
374
+
375
+ var selectableOptgroups = that.$selectableUl.children('.ms-optgroup-container');
376
+ if (selectableOptgroups.length > 0){
377
+ selectableOptgroups.each(function(){
378
+ var selectablesLi = $(this).find('.ms-elem-selectable');
379
+ if (selectablesLi.filter(':not(.ms-selected)').length > 0){
380
+ $(this).find('.ms-optgroup-label').show();
381
+ }
382
+ });
383
+
384
+ var selectionOptgroups = that.$selectionUl.children('.ms-optgroup-container');
385
+ selectionOptgroups.each(function(){
386
+ var selectionsLi = $(this).find('.ms-elem-selection');
387
+ if (selectionsLi.filter('.ms-selected').length === 0){
388
+ $(this).find('.ms-optgroup-label').hide();
389
+ }
390
+ });
391
+ }
392
+ ms.trigger('change');
393
+ if (typeof that.options.afterDeselect === 'function') {
394
+ that.options.afterDeselect.call(this, value);
395
+ }
396
+ }
397
+ },
398
+
399
+ 'select_all' : function(){
400
+ var ms = this.$element,
401
+ values = ms.val();
402
+
403
+ ms.find('option:not(":disabled")').prop('selected', true);
404
+ this.$selectableUl.find('.ms-elem-selectable').filter(':not(.'+this.options.disabledClass+')').addClass('ms-selected').hide();
405
+ this.$selectionUl.find('.ms-optgroup-label').show();
406
+ this.$selectableUl.find('.ms-optgroup-label').hide();
407
+ this.$selectionUl.find('.ms-elem-selection').filter(':not(.'+this.options.disabledClass+')').addClass('ms-selected').show();
408
+ this.$selectionUl.focus();
409
+ ms.trigger('change');
410
+ if (typeof this.options.afterSelect === 'function') {
411
+ var selectedValues = $.grep(ms.val(), function(item){
412
+ return $.inArray(item, values) < 0;
413
+ });
414
+ this.options.afterSelect.call(this, selectedValues);
415
+ }
416
+ },
417
+
418
+ 'deselect_all' : function(){
419
+ var ms = this.$element,
420
+ values = ms.val();
421
+
422
+ ms.find('option').prop('selected', false);
423
+ this.$selectableUl.find('.ms-elem-selectable').removeClass('ms-selected').show();
424
+ this.$selectionUl.find('.ms-optgroup-label').hide();
425
+ this.$selectableUl.find('.ms-optgroup-label').show();
426
+ this.$selectionUl.find('.ms-elem-selection').removeClass('ms-selected').hide();
427
+ this.$selectableUl.focus();
428
+ ms.trigger('change');
429
+ if (typeof this.options.afterDeselect === 'function') {
430
+ this.options.afterDeselect.call(this, values);
431
+ }
432
+ },
433
+
434
+ sanitize: function(value, reg){
435
+ return(value.replace(reg, '_'));
436
+ }
437
+ };
438
+
439
+ /* MULTISELECT PLUGIN DEFINITION
440
+ * ======================= */
441
+
442
+ $.fn.multiSelect = function () {
443
+ var option = arguments[0],
444
+ args = arguments;
445
+
446
+ return this.each(function () {
447
+ var $this = $(this),
448
+ data = $this.data('multiselect'),
449
+ options = $.extend({}, $.fn.multiSelect.defaults, $this.data(), typeof option === 'object' && option);
450
+
451
+ if (!data){ $this.data('multiselect', (data = new MultiSelect(this, options))); }
452
+
453
+ if (typeof option === 'string'){
454
+ data[option](args[1]);
455
+ } else {
456
+ data.init();
457
+ }
458
+ });
459
+ };
460
+
461
+ $.fn.multiSelect.defaults = {
462
+ selectableOptgroup: false,
463
+ disabledClass : 'disabled',
464
+ dblClick : false,
465
+ keepOrder: false
466
+ };
467
+
468
+ $.fn.multiSelect.Constructor = MultiSelect;
469
+
470
+ }(window.jQuery);
languages/default.mo CHANGED
Binary file
languages/default.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: Export User Data 0.5\n"
4
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/export-users-to-csv\n"
5
- "POT-Creation-Date: 2013-08-12 16:30-0000\n"
6
- "PO-Revision-Date: 2013-08-12 16:30-0000\n"
7
  "Last-Translator: Ray <studio@quintalinda.com>\n"
8
  "Language-Team: Q Studio <team@qstudio.us>\n"
9
  "Language: en\n"
@@ -16,67 +16,80 @@ msgstr ""
16
  "Plural-Forms: s;\n"
17
  "X-Poedit-SourceCharset: UTF-8\n"
18
  "X-Poedit-SearchPath-0: .\n"
 
19
 
20
- #: export-user-data.php:59 export-user-data.php:278
21
  msgid "Export User Data"
22
  msgstr ""
23
 
24
- #: export-user-data.php:273
25
  msgid "You do not have sufficient permissions to access this page."
26
  msgstr ""
27
 
28
- #: export-user-data.php:283
29
  msgid "No users found."
30
  msgstr ""
31
 
32
- #: export-user-data.php:356
33
  msgid "User Meta Fields"
34
  msgstr ""
35
 
36
- #: export-user-data.php:404
 
 
 
 
 
 
 
 
 
 
 
 
37
  msgid "BP xProfile Fields"
38
  msgstr ""
39
 
40
- #: export-user-data.php:424
41
  msgid "Role"
42
  msgstr ""
43
 
44
- #: export-user-data.php:429
45
  msgid "All Roles"
46
  msgstr ""
47
 
48
- #: export-user-data.php:446
49
  msgid "Programs"
50
  msgstr ""
51
 
52
- #: export-user-data.php:451
53
  msgid "All Programs"
54
  msgstr ""
55
 
56
- #: export-user-data.php:472
57
  msgid "Registred"
58
  msgstr ""
59
 
60
- #: export-user-data.php:475
61
  msgid "Start Date"
62
  msgstr ""
63
 
64
- #: export-user-data.php:479
65
  msgid "End Date"
66
  msgstr ""
67
 
68
- #: export-user-data.php:486
69
  msgid "Format"
70
  msgstr ""
71
 
72
- #: export-user-data.php:491
73
  msgid "Excel"
74
  msgstr ""
75
 
76
- #: export-user-data.php:492
77
  msgid "CSV"
78
  msgstr ""
79
 
80
- #: export-user-data.php:501
81
  msgid "Export"
82
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: Export User Data 0.6.3\n"
4
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/export-users-to-csv\n"
5
+ "POT-Creation-Date: 2013-08-19 15:34-0000\n"
6
+ "PO-Revision-Date: 2013-08-19 15:34-0000\n"
7
  "Last-Translator: Ray <studio@quintalinda.com>\n"
8
  "Language-Team: Q Studio <team@qstudio.us>\n"
9
  "Language: en\n"
16
  "Plural-Forms: s;\n"
17
  "X-Poedit-SourceCharset: UTF-8\n"
18
  "X-Poedit-SearchPath-0: .\n"
19
+ "X-Poedit-SearchPath-1: ..\n"
20
 
21
+ #: ../export-user-data.php:50 ../export-user-data.php:292
22
  msgid "Export User Data"
23
  msgstr ""
24
 
25
+ #: ../export-user-data.php:287
26
  msgid "You do not have sufficient permissions to access this page."
27
  msgstr ""
28
 
29
+ #: ../export-user-data.php:297
30
  msgid "No users found."
31
  msgstr ""
32
 
33
+ #: ../export-user-data.php:373
34
  msgid "User Meta Fields"
35
  msgstr ""
36
 
37
+ #: ../export-user-data.php:375
38
+ msgid "Filter"
39
+ msgstr ""
40
+
41
+ #: ../export-user-data.php:375
42
+ msgid "All"
43
+ msgstr ""
44
+
45
+ #: ../export-user-data.php:375
46
+ msgid "Common"
47
+ msgstr ""
48
+
49
+ #: ../export-user-data.php:450
50
  msgid "BP xProfile Fields"
51
  msgstr ""
52
 
53
+ #: ../export-user-data.php:476
54
  msgid "Role"
55
  msgstr ""
56
 
57
+ #: ../export-user-data.php:481
58
  msgid "All Roles"
59
  msgstr ""
60
 
61
+ #: ../export-user-data.php:498
62
  msgid "Programs"
63
  msgstr ""
64
 
65
+ #: ../export-user-data.php:503
66
  msgid "All Programs"
67
  msgstr ""
68
 
69
+ #: ../export-user-data.php:524
70
  msgid "Registred"
71
  msgstr ""
72
 
73
+ #: ../export-user-data.php:527
74
  msgid "Start Date"
75
  msgstr ""
76
 
77
+ #: ../export-user-data.php:531
78
  msgid "End Date"
79
  msgstr ""
80
 
81
+ #: ../export-user-data.php:538
82
  msgid "Format"
83
  msgstr ""
84
 
85
+ #: ../export-user-data.php:543
86
  msgid "Excel"
87
  msgstr ""
88
 
89
+ #: ../export-user-data.php:544
90
  msgid "CSV"
91
  msgstr ""
92
 
93
+ #: ../export-user-data.php:553
94
  msgid "Export"
95
  msgstr ""
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Q Studio
3
  Tags: user, users, xprofile, usermeta csv, excel, batch, export, save
4
  Requires at least: 3.2
5
  Tested up to: 3.6
6
- Stable tag: 0.6.1
7
  License: GPLv2
8
 
9
  Export users data, metadata and buddypress xprofile data to a csv or Excel file
@@ -60,10 +60,16 @@ Click on the 'Export User Data' link in the 'Users' menu, choose the role and th
60
 
61
  == Changelog ==
62
 
 
 
 
63
  = 0.5 =
64
  * First public release.
65
 
66
  == Upgrade Notice ==
67
 
 
 
 
68
  = 0.5 =
69
  First release.
3
  Tags: user, users, xprofile, usermeta csv, excel, batch, export, save
4
  Requires at least: 3.2
5
  Tested up to: 3.6
6
+ Stable tag: 0.6.3
7
  License: GPLv2
8
 
9
  Export users data, metadata and buddypress xprofile data to a csv or Excel file
60
 
61
  == Changelog ==
62
 
63
+ = 0.6.3 =
64
+ * added multiselect to pick usermeta and xprofile fields
65
+
66
  = 0.5 =
67
  * First public release.
68
 
69
  == Upgrade Notice ==
70
 
71
+ = 0.6.3 =
72
+ Latest.
73
+
74
  = 0.5 =
75
  First release.