Version Description
Download this release
Release Info
Developer | qlstudio |
Plugin | Export User Data |
Version | 0.6.4 |
Comparing to | |
See all releases |
Code changes from version 0.6.3 to 0.6.4
- tags/0.5.1/export-user-data.php +553 -0
- tags/0.5.1/languages/default.mo +0 -0
- tags/0.5.1/languages/default.po +82 -0
- tags/0.5.1/readme.txt +68 -0
- screenshot-1.png → tags/0.5.1/screenshot-1.png +0 -0
- tags/0.5.2/export-user-data.php +538 -0
- tags/0.5.2/languages/default.mo +0 -0
- tags/0.5.2/languages/default.po +82 -0
- tags/0.5.2/readme.txt +68 -0
- tags/0.5.2/screenshot-1.png +0 -0
- tags/0.5.3/export-user-data.php +541 -0
- tags/0.5.3/languages/default.mo +0 -0
- tags/0.5.3/languages/default.po +82 -0
- tags/0.5.3/readme.txt +69 -0
- tags/0.5.3/screenshot-1.png +0 -0
- tags/0.6.1/export-user-data.php +541 -0
- tags/0.6.1/languages/default.mo +0 -0
- tags/0.6.1/languages/default.po +82 -0
- tags/0.6.1/readme.txt +69 -0
- tags/0.6.1/screenshot-1.png +0 -0
- {css → tags/0.6.3/css}/multi-select.css +0 -0
- export-user-data.php → tags/0.6.3/export-user-data.php +0 -0
- {img → tags/0.6.3/img}/switch.png +0 -0
- {js → tags/0.6.3/js}/jquery.multi-select.js +0 -0
- {languages → tags/0.6.3/languages}/default.mo +0 -0
- {languages → tags/0.6.3/languages}/default.po +0 -0
- readme.txt → tags/0.6.3/readme.txt +0 -0
- tags/0.6.3/screenshot-1.png +0 -0
- tags/0.6/export-user-data.php +538 -0
- tags/0.6/languages/default.mo +0 -0
- tags/0.6/languages/default.po +82 -0
- tags/0.6/readme.txt +68 -0
- tags/0.6/screenshot-1.png +0 -0
- trunk/css/multi-select.css +97 -0
- trunk/export-user-data.php +605 -0
- trunk/img/switch.png +0 -0
- trunk/js/jquery.multi-select.js +470 -0
- trunk/languages/default.mo +0 -0
- trunk/languages/default.po +95 -0
- trunk/readme.txt +75 -0
- trunk/screenshot-1.png +0 -0
tags/0.5.1/export-user-data.php
ADDED
@@ -0,0 +1,553 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Export_User_Data
|
4 |
+
* @version 0.5
|
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.5.1
|
11 |
+
Author: Q Studio
|
12 |
+
Author URI: http://qstudio.us/
|
13 |
+
License: GPL2
|
14 |
+
Text Domain: export-user-data
|
15 |
+
Source: Export User to CSV by PubPoet ( http://pubpoet.com/ )- Thanks!
|
16 |
+
*/
|
17 |
+
/* Copyright 2011 Ulrich Sossou (http://github.com/sorich87)
|
18 |
+
|
19 |
+
This program is free software; you can redistribute it and/or modify
|
20 |
+
it under the terms of the GNU General Public License, version 2, as
|
21 |
+
published by the Free Software Foundation.
|
22 |
+
|
23 |
+
This program is distributed in the hope that it will be useful,
|
24 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
+
GNU General Public License for more details.
|
27 |
+
|
28 |
+
You should have received a copy of the GNU General Public License
|
29 |
+
along with this program; if not, write to the Free Software
|
30 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
31 |
+
*/
|
32 |
+
|
33 |
+
load_plugin_textdomain( 'export-user-data', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Main plugin class
|
37 |
+
*
|
38 |
+
* @since 0.1
|
39 |
+
**/
|
40 |
+
class Q_EUD_Export_Users {
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Class contructor
|
44 |
+
*
|
45 |
+
* @since 0.1
|
46 |
+
**/
|
47 |
+
public function __construct() {
|
48 |
+
add_action( 'admin_menu', array( $this, 'add_admin_pages' ) );
|
49 |
+
add_action( 'init', array( $this, 'generate_data' ) );
|
50 |
+
add_filter( 'q_eud_exclude_data', array( $this, 'exclude_data' ) );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Add administration menus
|
55 |
+
*
|
56 |
+
* @since 0.1
|
57 |
+
**/
|
58 |
+
public function add_admin_pages() {
|
59 |
+
add_users_page( __( 'Export User Data', 'export-user-data' ), __( 'Export User Data', 'export-user-data' ), 'list_users', 'export-user-data', array( $this, 'users_page' ) );
|
60 |
+
}
|
61 |
+
|
62 |
+
/* clean that stuff up ## */
|
63 |
+
public function sanitize($value) {
|
64 |
+
$value = str_replace("\r", '', $value);
|
65 |
+
$value = str_replace("\n", '', $value);
|
66 |
+
$value = str_replace("\t", '', $value);
|
67 |
+
return $value;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Process content of CSV file
|
72 |
+
*
|
73 |
+
* @since 0.1
|
74 |
+
**/
|
75 |
+
public function generate_data() {
|
76 |
+
if ( isset( $_POST['_wpnonce-q-eud-export-user-page_export'] ) ) {
|
77 |
+
check_admin_referer( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' );
|
78 |
+
|
79 |
+
// build argument array ##
|
80 |
+
$args = array(
|
81 |
+
'fields' => 'all_with_meta',
|
82 |
+
'role' => stripslashes( $_POST['role'] )
|
83 |
+
);
|
84 |
+
|
85 |
+
// did the user request a specific program ? ##
|
86 |
+
if ( isset( $_POST['program'] ) && $_POST['program'] != '' ) {
|
87 |
+
|
88 |
+
$args['meta_key'] = 'member_of_club';
|
89 |
+
$args['meta_value'] = (int)$_POST['program'];
|
90 |
+
$args['meta_compare'] = '=';
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
+
add_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
95 |
+
$users = get_users( $args );
|
96 |
+
remove_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
97 |
+
|
98 |
+
if ( ! $users ) {
|
99 |
+
$referer = add_query_arg( 'error', 'empty', wp_get_referer() );
|
100 |
+
wp_redirect( $referer );
|
101 |
+
exit;
|
102 |
+
}
|
103 |
+
|
104 |
+
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
105 |
+
if ( ! empty( $sitename ) )
|
106 |
+
$sitename .= '.';
|
107 |
+
|
108 |
+
// export method ? ##
|
109 |
+
$export_method = 'excel'; // default to Excel export ##
|
110 |
+
if ( isset( $_POST['format'] ) && $_POST['format'] != '' ) {
|
111 |
+
|
112 |
+
$export_method = $_POST['format'];
|
113 |
+
|
114 |
+
}
|
115 |
+
|
116 |
+
// set export filename structure ##
|
117 |
+
$filename = $sitename . 'users.' . date( 'Y-m-d-H-i-s' );
|
118 |
+
|
119 |
+
switch ( $export_method ) {
|
120 |
+
|
121 |
+
case "csv":
|
122 |
+
|
123 |
+
// to csv ##
|
124 |
+
header( 'Content-Description: File Transfer' );
|
125 |
+
header( 'Content-Disposition: attachment; filename='.$filename.'.csv' );
|
126 |
+
header( 'Content-Type: text/csv; charset=' . get_option( 'blog_charset' ), true );
|
127 |
+
|
128 |
+
// how to seperate data ##
|
129 |
+
$seperator = ','; // comma for csv ##
|
130 |
+
|
131 |
+
break;
|
132 |
+
|
133 |
+
case ('excel'):
|
134 |
+
|
135 |
+
// to xls ##
|
136 |
+
header( 'Content-Description: File Transfer' );
|
137 |
+
header("Content-Type: application/vnd.ms-excel");
|
138 |
+
header("Content-Disposition: attachment; filename=$filename.xls");
|
139 |
+
header("Pragma: no-cache");
|
140 |
+
header("Expires: 0");
|
141 |
+
|
142 |
+
// how to seperate data ##
|
143 |
+
$seperator = "\t"; //tabbed character
|
144 |
+
|
145 |
+
break;
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
// line break ##
|
150 |
+
$breaker = "\n";
|
151 |
+
|
152 |
+
// function to exclude data ##
|
153 |
+
$exclude_data = apply_filters( 'q_eud_exclude_data', array() );
|
154 |
+
|
155 |
+
// check for selected usermeta fields ##
|
156 |
+
$usermeta = $_POST['usermeta'];
|
157 |
+
$usermeta_fields = array();
|
158 |
+
foreach( $usermeta as $field ) {
|
159 |
+
$usermeta_fields[] = $field;
|
160 |
+
}
|
161 |
+
|
162 |
+
// array of usermeta fields to include ##
|
163 |
+
/*
|
164 |
+
$usermeta_fields = array(
|
165 |
+
'member_of_club', // program ID ##
|
166 |
+
'last_activity', // last BP activity ##
|
167 |
+
'q_api_u_key', // Adage registration key ##
|
168 |
+
'rewards_milestone', // if reward milestone reached ##
|
169 |
+
'total_friend_count', // BP friend count ##
|
170 |
+
);
|
171 |
+
*/
|
172 |
+
|
173 |
+
// check for selected x profile fields ##
|
174 |
+
$bp_fields = $_POST['bp_fields'];
|
175 |
+
$bp_fields_passed = array();
|
176 |
+
foreach( $bp_fields as $field ) {
|
177 |
+
|
178 |
+
// reverse tidy ##
|
179 |
+
$field = str_replace( '__', ' ', $field );
|
180 |
+
|
181 |
+
// add to array ##
|
182 |
+
$bp_fields_passed[] = $field;
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
// global wpdb object ##
|
187 |
+
global $wpdb;
|
188 |
+
|
189 |
+
// requested user data ##
|
190 |
+
$data_keys = array(
|
191 |
+
'ID', 'user_login', 'user_pass',
|
192 |
+
'user_nicename', 'user_email', 'user_url',
|
193 |
+
'user_registered', /*'user_activation_key',*/ /*'user_status',*/
|
194 |
+
'display_name'
|
195 |
+
);
|
196 |
+
|
197 |
+
// compile final fields list ##
|
198 |
+
$fields = array_merge( $data_keys, $usermeta_fields, $bp_fields_passed );
|
199 |
+
|
200 |
+
// build the document headers ##
|
201 |
+
$headers = array();
|
202 |
+
foreach ( $fields as $key => $field ) {
|
203 |
+
|
204 |
+
// rename programs field ##
|
205 |
+
if ( $field == 'member_of_club' ){
|
206 |
+
$field = 'Program';
|
207 |
+
}
|
208 |
+
|
209 |
+
if ( in_array( $field, $exclude_data ) )
|
210 |
+
unset( $fields[$key] );
|
211 |
+
else
|
212 |
+
$headers[] = '"' . $field . '"';
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
// echo headers ##
|
217 |
+
echo implode( $seperator, $headers ) . $breaker;
|
218 |
+
|
219 |
+
// build row values for each user ##
|
220 |
+
foreach ( $users as $user ) {
|
221 |
+
|
222 |
+
$data = array();
|
223 |
+
foreach ( $fields as $field ) {
|
224 |
+
|
225 |
+
// BP loaded ? ##
|
226 |
+
if ( function_exists ('bp_is_active') ) {
|
227 |
+
$bp_data = BP_XProfile_ProfileData::get_all_for_user($user->ID);
|
228 |
+
}
|
229 |
+
|
230 |
+
// check if this is a BP field ##
|
231 |
+
if ( in_array( $field, $bp_fields_passed ) ) {
|
232 |
+
|
233 |
+
$value = $bp_data[$field];
|
234 |
+
|
235 |
+
if (is_array($value)) {
|
236 |
+
$value = $value['field_data'];
|
237 |
+
}
|
238 |
+
$value = $this->sanitize($value);
|
239 |
+
|
240 |
+
// user data or usermeta ##
|
241 |
+
} else {
|
242 |
+
|
243 |
+
$value = isset( $user->{$field} ) ? $user->{$field} : '';
|
244 |
+
$value = is_array( $value ) ? serialize( $value ) : $value;
|
245 |
+
|
246 |
+
}
|
247 |
+
|
248 |
+
// correct program value to Program Name ##
|
249 |
+
if ( $field == 'member_of_club' ){
|
250 |
+
$value = get_the_title($value);
|
251 |
+
}
|
252 |
+
|
253 |
+
$data[] = '"' . str_replace( '"', '""', $value ) . '"';
|
254 |
+
|
255 |
+
}
|
256 |
+
|
257 |
+
// echo row data ##
|
258 |
+
echo implode( $seperator, $data ) . $breaker;
|
259 |
+
}
|
260 |
+
|
261 |
+
// stop PHP, so file can export correctly ##
|
262 |
+
exit;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Content of the settings page
|
268 |
+
*
|
269 |
+
* @since 0.1
|
270 |
+
**/
|
271 |
+
public function users_page() {
|
272 |
+
if ( ! current_user_can( 'list_users' ) ) {
|
273 |
+
wp_die( __( 'You do not have sufficient permissions to access this page.', 'export-user-data' ) );
|
274 |
+
}
|
275 |
+
?>
|
276 |
+
|
277 |
+
<div class="wrap">
|
278 |
+
<h2><?php _e( 'Export User Data', 'export-user-data' ); ?></h2>
|
279 |
+
<?php
|
280 |
+
|
281 |
+
// nothing happening? ##
|
282 |
+
if ( isset( $_GET['error'] ) ) {
|
283 |
+
echo '<div class="updated"><p><strong>' . __( 'No users found.', 'export-user-data' ) . '</strong></p></div>';
|
284 |
+
}
|
285 |
+
|
286 |
+
?>
|
287 |
+
<form method="post" action="" enctype="multipart/form-data">
|
288 |
+
<?php wp_nonce_field( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' ); ?>
|
289 |
+
<table class="form-table">
|
290 |
+
<?php
|
291 |
+
|
292 |
+
// allow admin to select user meta fields to export ##
|
293 |
+
global $wpdb;
|
294 |
+
$meta_keys = $wpdb->get_results( "SELECT distinct(meta_key) FROM $wpdb->usermeta" );
|
295 |
+
|
296 |
+
// get meta_key value from object ##
|
297 |
+
$meta_keys = wp_list_pluck( $meta_keys, 'meta_key' );
|
298 |
+
|
299 |
+
// let's ditch some of them odd keys ##
|
300 |
+
$meta_keys_drop = array(
|
301 |
+
'metaboxhidden',
|
302 |
+
'activation',
|
303 |
+
'bp_',
|
304 |
+
'nav_',
|
305 |
+
'wp_',
|
306 |
+
'admin_color',
|
307 |
+
'wpmudev',
|
308 |
+
'screen_',
|
309 |
+
'show_',
|
310 |
+
'rich_',
|
311 |
+
'reward_',
|
312 |
+
'meta-box',
|
313 |
+
'manageedit',
|
314 |
+
'edit_',
|
315 |
+
'closedpostboxes_',
|
316 |
+
'dismissed_',
|
317 |
+
'manage',
|
318 |
+
'comment',
|
319 |
+
'current',
|
320 |
+
'incentive_',
|
321 |
+
'_wdp',
|
322 |
+
'ssl',
|
323 |
+
'wdfb',
|
324 |
+
'users_per_page',
|
325 |
+
);
|
326 |
+
|
327 |
+
// allow array to be filtered ##
|
328 |
+
$meta_keys_drop = apply_filters( 'export_user_data_meta_keys_drop', $meta_keys_drop );
|
329 |
+
|
330 |
+
foreach ( $meta_keys as $key ) {
|
331 |
+
|
332 |
+
foreach ( $meta_keys_drop as $drop ) {
|
333 |
+
|
334 |
+
if ( strpos( $key, $drop ) !== false ) {
|
335 |
+
|
336 |
+
#echo 'FOUND -- '.$drop.' in '.$key.'<br />';
|
337 |
+
|
338 |
+
if(($key = array_search($key, $meta_keys)) !== false) {
|
339 |
+
unset($meta_keys[$key]);
|
340 |
+
}
|
341 |
+
|
342 |
+
}
|
343 |
+
|
344 |
+
}
|
345 |
+
|
346 |
+
}
|
347 |
+
|
348 |
+
// test array ##
|
349 |
+
#echo '<pre>'; var_dump($meta_keys); echo '</pre>';
|
350 |
+
|
351 |
+
// check if we got anything ? ##
|
352 |
+
if ( $meta_keys ) {
|
353 |
+
|
354 |
+
?>
|
355 |
+
<tr valign="top">
|
356 |
+
<th scope="row"><label for="q_eud_usermeta"><?php _e( 'User Meta Fields', 'export-user-data' ); ?></label></th>
|
357 |
+
<td>
|
358 |
+
<?php
|
359 |
+
|
360 |
+
foreach ( $meta_keys as $key ) {
|
361 |
+
|
362 |
+
#echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
363 |
+
|
364 |
+
// display $key ##
|
365 |
+
$display_key = $key;
|
366 |
+
|
367 |
+
// rename programs field ##
|
368 |
+
if ( $display_key == 'member_of_club' ){
|
369 |
+
$display_key = 'program';
|
370 |
+
}
|
371 |
+
|
372 |
+
// tidy ##
|
373 |
+
$display_key = str_replace( "_", " ", ucwords($display_key) );
|
374 |
+
|
375 |
+
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 />";
|
376 |
+
}
|
377 |
+
?>
|
378 |
+
</td>
|
379 |
+
</tr>
|
380 |
+
<?php
|
381 |
+
|
382 |
+
} // meta_keys found ##
|
383 |
+
|
384 |
+
?>
|
385 |
+
<?php
|
386 |
+
|
387 |
+
// buddypress x profile data ##
|
388 |
+
if ( function_exists ('bp_is_active') ) {
|
389 |
+
|
390 |
+
// grab all buddypress x profile fields ##
|
391 |
+
$bp_fields = $wpdb->get_results( "SELECT distinct(name) FROM ".$wpdb->base_prefix."bp_xprofile_fields WHERE parent_id = 0" );
|
392 |
+
|
393 |
+
// get name value from object ##
|
394 |
+
$bp_fields = wp_list_pluck( $bp_fields, 'name' );
|
395 |
+
|
396 |
+
// test array ##
|
397 |
+
#echo '<pre>'; var_dump($bp_fields); echo '</pre>';
|
398 |
+
|
399 |
+
// allow array to be filtered ##
|
400 |
+
$bp_fields = apply_filters( 'export_user_data_bp_fields', $bp_fields );
|
401 |
+
|
402 |
+
?>
|
403 |
+
<tr valign="top">
|
404 |
+
<th scope="row"><label for="q_eud_xprofile"><?php _e( 'BP xProfile Fields', 'export-user-data' ); ?></label></th>
|
405 |
+
<td>
|
406 |
+
<?php
|
407 |
+
|
408 |
+
foreach ( $bp_fields as $key ) {
|
409 |
+
|
410 |
+
// tidy up key ##
|
411 |
+
$key_tidy = str_replace( ' ', '__', ($key));
|
412 |
+
|
413 |
+
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 />";
|
414 |
+
}
|
415 |
+
?>
|
416 |
+
</td>
|
417 |
+
</tr>
|
418 |
+
<?php
|
419 |
+
|
420 |
+
} // BP installed and active ##
|
421 |
+
|
422 |
+
?>
|
423 |
+
<tr valign="top">
|
424 |
+
<th scope="row"><label for="q_eud_users_role"><?php _e( 'Role', 'export-user-data' ); ?></label></th>
|
425 |
+
<td>
|
426 |
+
<select name="role" id="q_eud_users_role">
|
427 |
+
<?php
|
428 |
+
|
429 |
+
echo '<option value="">' . __( 'All Roles', 'export-user-data' ) . '</option>';
|
430 |
+
global $wp_roles;
|
431 |
+
foreach ( $wp_roles->role_names as $role => $name ) {
|
432 |
+
echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
433 |
+
}
|
434 |
+
|
435 |
+
?>
|
436 |
+
</select>
|
437 |
+
</td>
|
438 |
+
</tr>
|
439 |
+
<?php
|
440 |
+
|
441 |
+
// clubs ? ##
|
442 |
+
if ( post_type_exists( 'club' ) ) {
|
443 |
+
|
444 |
+
?>
|
445 |
+
<tr valign="top">
|
446 |
+
<th scope="row"><label for="q_eud_users_program"><?php _e( 'Programs', 'export-user-data' ); ?></label></th>
|
447 |
+
<td>
|
448 |
+
<select name="program" id="q_eud_users_program">
|
449 |
+
<?php
|
450 |
+
|
451 |
+
echo '<option value="">' . __( 'All Programs', 'export-user-data' ) . '</option>';
|
452 |
+
|
453 |
+
$clubs_array = get_posts(array( 'post_type'=> 'club', 'posts_per_page' => -1 )); // grab all posts of type "club" ##
|
454 |
+
|
455 |
+
foreach ( $clubs_array as $c ) { // loop over all clubs ##
|
456 |
+
|
457 |
+
#$clubs[$c->ID] = $c; // grab club ID ##
|
458 |
+
echo "\n\t<option value='" . esc_attr( $c->ID ) . "'>$c->post_title</option>";
|
459 |
+
|
460 |
+
}
|
461 |
+
|
462 |
+
?>
|
463 |
+
</select>
|
464 |
+
</td>
|
465 |
+
</tr>
|
466 |
+
<?php
|
467 |
+
|
468 |
+
} // clubs ##
|
469 |
+
|
470 |
+
?>
|
471 |
+
<tr valign="top">
|
472 |
+
<th scope="row"><label><?php _e( 'Registred', 'export-user-data' ); ?></label></th>
|
473 |
+
<td>
|
474 |
+
<select name="start_date" id="q_eud_users_start_date">
|
475 |
+
<option value="0"><?php _e( 'Start Date', 'export-user-data' ); ?></option>
|
476 |
+
<?php $this->export_date_options(); ?>
|
477 |
+
</select>
|
478 |
+
<select name="end_date" id="q_eud_users_end_date">
|
479 |
+
<option value="0"><?php _e( 'End Date', 'export-user-data' ); ?></option>
|
480 |
+
<?php $this->export_date_options(); ?>
|
481 |
+
</select>
|
482 |
+
</td>
|
483 |
+
</tr>
|
484 |
+
|
485 |
+
<tr valign="top">
|
486 |
+
<th scope="row"><label for="q_eud_users_format"><?php _e( 'Format', 'export-user-data' ); ?></label></th>
|
487 |
+
<td>
|
488 |
+
<select name="format" id="q_eud_users_format">
|
489 |
+
<?php
|
490 |
+
|
491 |
+
echo '<option value="excel">' . __( 'Excel', 'export-user-data' ) . '</option>';
|
492 |
+
echo '<option value="csv">' . __( 'CSV', 'export-user-data' ) . '</option>';
|
493 |
+
|
494 |
+
?>
|
495 |
+
</select>
|
496 |
+
</td>
|
497 |
+
</tr>
|
498 |
+
</table>
|
499 |
+
<p class="submit">
|
500 |
+
<input type="hidden" name="_wp_http_referer" value="<?php echo $_SERVER['REQUEST_URI'] ?>" />
|
501 |
+
<input type="submit" class="button-primary" value="<?php _e( 'Export', 'export-user-data' ); ?>" />
|
502 |
+
</p>
|
503 |
+
</form>
|
504 |
+
<?php
|
505 |
+
}
|
506 |
+
|
507 |
+
// data to exclude from export ##
|
508 |
+
public function exclude_data() {
|
509 |
+
$exclude = array( 'user_pass', 'user_activation_key' );
|
510 |
+
return $exclude;
|
511 |
+
}
|
512 |
+
|
513 |
+
public function pre_user_query( $user_search ) {
|
514 |
+
global $wpdb;
|
515 |
+
|
516 |
+
$where = '';
|
517 |
+
|
518 |
+
if ( ! empty( $_POST['start_date'] ) )
|
519 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered >= %s", date( 'Y-m-d', strtotime( $_POST['start_date'] ) ) );
|
520 |
+
|
521 |
+
if ( ! empty( $_POST['end_date'] ) )
|
522 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $_POST['end_date'] ) ) ) );
|
523 |
+
|
524 |
+
if ( ! empty( $where ) )
|
525 |
+
$user_search->query_where = str_replace( 'WHERE 1=1', "WHERE 1=1 $where", $user_search->query_where );
|
526 |
+
|
527 |
+
return $user_search;
|
528 |
+
}
|
529 |
+
|
530 |
+
private function export_date_options() {
|
531 |
+
global $wpdb, $wp_locale;
|
532 |
+
|
533 |
+
$months = $wpdb->get_results( "
|
534 |
+
SELECT DISTINCT YEAR( user_registered ) AS year, MONTH( user_registered ) AS month
|
535 |
+
FROM $wpdb->users
|
536 |
+
ORDER BY user_registered DESC
|
537 |
+
" );
|
538 |
+
|
539 |
+
$month_count = count( $months );
|
540 |
+
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
|
541 |
+
return;
|
542 |
+
|
543 |
+
foreach ( $months as $date ) {
|
544 |
+
if ( 0 == $date->year )
|
545 |
+
continue;
|
546 |
+
|
547 |
+
$month = zeroise( $date->month, 2 );
|
548 |
+
echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';
|
549 |
+
}
|
550 |
+
}
|
551 |
+
}
|
552 |
+
|
553 |
+
new Q_EUD_Export_Users;
|
tags/0.5.1/languages/default.mo
ADDED
Binary file
|
tags/0.5.1/languages/default.po
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.5.4\n"
|
14 |
+
"X-Poedit-KeywordsList: _;_e;_n;__\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
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 ""
|
tags/0.5.1/readme.txt
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
Contributors: Q Studio sorich87
|
3 |
+
Tags: user, users, xprofile, usermeta csv, excel, batch, export, exporter, admin
|
4 |
+
Requires at least: 3.2
|
5 |
+
Tested up to: 3.6
|
6 |
+
Stable tag: 0.5.1
|
7 |
+
Original: http://wordpress.org/plugins/export-users-to-csv/
|
8 |
+
License: GPLv2
|
9 |
+
|
10 |
+
Export users data, metadata and buddypress xprofile data to a csv or Excel file
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
A plugin that export ALL user data, meta data and BuddyPress xProfile data.
|
15 |
+
|
16 |
+
Includes an option to export the users by role, registration date range, usermeta option and two export formats.
|
17 |
+
|
18 |
+
= Features =
|
19 |
+
|
20 |
+
* Exports all users fields
|
21 |
+
* Exports users meta
|
22 |
+
* Exports users by role
|
23 |
+
* Exports users by date range
|
24 |
+
* Export user BuddyPress xProfile data
|
25 |
+
|
26 |
+
For feature request and bug reports, [please use the forums](http://wordpress.org/tags/export-users-data).
|
27 |
+
|
28 |
+
== Installation ==
|
29 |
+
|
30 |
+
For an automatic installation through WordPress:
|
31 |
+
|
32 |
+
1. Go to the 'Add New' plugins screen in your WordPress admin area
|
33 |
+
1. Search for 'Export User Data'
|
34 |
+
1. Click 'Install Now' and activate the plugin
|
35 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
36 |
+
|
37 |
+
|
38 |
+
For a manual installation via FTP:
|
39 |
+
|
40 |
+
1. Upload the `export-user-data` directory to the `/wp-content/plugins/` directory
|
41 |
+
1. Activate the plugin through the 'Plugins' screen in your WordPress admin area
|
42 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
43 |
+
|
44 |
+
|
45 |
+
To upload the plugin through WordPress, instead of FTP:
|
46 |
+
|
47 |
+
1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
|
48 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
49 |
+
|
50 |
+
== Frequently Asked Questions ==
|
51 |
+
|
52 |
+
= How to use? =
|
53 |
+
|
54 |
+
Click on the 'Export User Data' link in the 'Users' menu, choose the role and the date range or don't select anything if you want to export all users, then click 'Export'. That's all!
|
55 |
+
|
56 |
+
== Screenshots ==
|
57 |
+
|
58 |
+
1. User export screen
|
59 |
+
|
60 |
+
== Changelog ==
|
61 |
+
|
62 |
+
= 0.5 =
|
63 |
+
* First public release.
|
64 |
+
|
65 |
+
== Upgrade Notice ==
|
66 |
+
|
67 |
+
= 0.5 =
|
68 |
+
First release.
|
screenshot-1.png → tags/0.5.1/screenshot-1.png
RENAMED
File without changes
|
tags/0.5.2/export-user-data.php
ADDED
@@ -0,0 +1,538 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Export_User_Data
|
4 |
+
* @version 0.5.2
|
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.5.2
|
11 |
+
Author: Q Studio
|
12 |
+
Author URI: http://qstudio.us/
|
13 |
+
License: GPL2
|
14 |
+
Text Domain: export-user-data
|
15 |
+
Based on: Export User to CSV by PubPoet ( http://pubpoet.com/ )- Thanks!
|
16 |
+
*/
|
17 |
+
|
18 |
+
load_plugin_textdomain( 'export-user-data', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Main plugin class
|
22 |
+
*
|
23 |
+
* @since 0.1
|
24 |
+
**/
|
25 |
+
class Q_EUD_Export_Users {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class contructor
|
29 |
+
*
|
30 |
+
* @since 0.1
|
31 |
+
**/
|
32 |
+
public function __construct() {
|
33 |
+
add_action( 'admin_menu', array( $this, 'add_admin_pages' ) );
|
34 |
+
add_action( 'init', array( $this, 'generate_data' ) );
|
35 |
+
add_filter( 'q_eud_exclude_data', array( $this, 'exclude_data' ) );
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Add administration menus
|
40 |
+
*
|
41 |
+
* @since 0.1
|
42 |
+
**/
|
43 |
+
public function add_admin_pages() {
|
44 |
+
add_users_page( __( 'Export User Data', 'export-user-data' ), __( 'Export User Data', 'export-user-data' ), 'list_users', 'export-user-data', array( $this, 'users_page' ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
/* clean that stuff up ## */
|
48 |
+
public function sanitize($value) {
|
49 |
+
$value = str_replace("\r", '', $value);
|
50 |
+
$value = str_replace("\n", '', $value);
|
51 |
+
$value = str_replace("\t", '', $value);
|
52 |
+
return $value;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Process content of CSV file
|
57 |
+
*
|
58 |
+
* @since 0.1
|
59 |
+
**/
|
60 |
+
public function generate_data() {
|
61 |
+
if ( isset( $_POST['_wpnonce-q-eud-export-user-page_export'] ) ) {
|
62 |
+
check_admin_referer( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' );
|
63 |
+
|
64 |
+
// build argument array ##
|
65 |
+
$args = array(
|
66 |
+
'fields' => 'all_with_meta',
|
67 |
+
'role' => stripslashes( $_POST['role'] )
|
68 |
+
);
|
69 |
+
|
70 |
+
// did the user request a specific program ? ##
|
71 |
+
if ( isset( $_POST['program'] ) && $_POST['program'] != '' ) {
|
72 |
+
|
73 |
+
$args['meta_key'] = 'member_of_club';
|
74 |
+
$args['meta_value'] = (int)$_POST['program'];
|
75 |
+
$args['meta_compare'] = '=';
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
add_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
80 |
+
$users = get_users( $args );
|
81 |
+
remove_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
82 |
+
|
83 |
+
if ( ! $users ) {
|
84 |
+
$referer = add_query_arg( 'error', 'empty', wp_get_referer() );
|
85 |
+
wp_redirect( $referer );
|
86 |
+
exit;
|
87 |
+
}
|
88 |
+
|
89 |
+
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
90 |
+
if ( ! empty( $sitename ) )
|
91 |
+
$sitename .= '.';
|
92 |
+
|
93 |
+
// export method ? ##
|
94 |
+
$export_method = 'excel'; // default to Excel export ##
|
95 |
+
if ( isset( $_POST['format'] ) && $_POST['format'] != '' ) {
|
96 |
+
|
97 |
+
$export_method = $_POST['format'];
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
// set export filename structure ##
|
102 |
+
$filename = $sitename . 'users.' . date( 'Y-m-d-H-i-s' );
|
103 |
+
|
104 |
+
switch ( $export_method ) {
|
105 |
+
|
106 |
+
case "csv":
|
107 |
+
|
108 |
+
// to csv ##
|
109 |
+
header( 'Content-Description: File Transfer' );
|
110 |
+
header( 'Content-Disposition: attachment; filename='.$filename.'.csv' );
|
111 |
+
header( 'Content-Type: text/csv; charset=' . get_option( 'blog_charset' ), true );
|
112 |
+
|
113 |
+
// how to seperate data ##
|
114 |
+
$seperator = ','; // comma for csv ##
|
115 |
+
|
116 |
+
break;
|
117 |
+
|
118 |
+
case ('excel'):
|
119 |
+
|
120 |
+
// to xls ##
|
121 |
+
header( 'Content-Description: File Transfer' );
|
122 |
+
header("Content-Type: application/vnd.ms-excel");
|
123 |
+
header("Content-Disposition: attachment; filename=$filename.xls");
|
124 |
+
header("Pragma: no-cache");
|
125 |
+
header("Expires: 0");
|
126 |
+
|
127 |
+
// how to seperate data ##
|
128 |
+
$seperator = "\t"; //tabbed character
|
129 |
+
|
130 |
+
break;
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
// line break ##
|
135 |
+
$breaker = "\n";
|
136 |
+
|
137 |
+
// function to exclude data ##
|
138 |
+
$exclude_data = apply_filters( 'q_eud_exclude_data', array() );
|
139 |
+
|
140 |
+
// check for selected usermeta fields ##
|
141 |
+
$usermeta = $_POST['usermeta'];
|
142 |
+
$usermeta_fields = array();
|
143 |
+
foreach( $usermeta as $field ) {
|
144 |
+
$usermeta_fields[] = $field;
|
145 |
+
}
|
146 |
+
|
147 |
+
// array of usermeta fields to include ##
|
148 |
+
/*
|
149 |
+
$usermeta_fields = array(
|
150 |
+
'member_of_club', // program ID ##
|
151 |
+
'last_activity', // last BP activity ##
|
152 |
+
'q_api_u_key', // Adage registration key ##
|
153 |
+
'rewards_milestone', // if reward milestone reached ##
|
154 |
+
'total_friend_count', // BP friend count ##
|
155 |
+
);
|
156 |
+
*/
|
157 |
+
|
158 |
+
// check for selected x profile fields ##
|
159 |
+
$bp_fields = $_POST['bp_fields'];
|
160 |
+
$bp_fields_passed = array();
|
161 |
+
foreach( $bp_fields as $field ) {
|
162 |
+
|
163 |
+
// reverse tidy ##
|
164 |
+
$field = str_replace( '__', ' ', $field );
|
165 |
+
|
166 |
+
// add to array ##
|
167 |
+
$bp_fields_passed[] = $field;
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
// global wpdb object ##
|
172 |
+
global $wpdb;
|
173 |
+
|
174 |
+
// requested user data ##
|
175 |
+
$data_keys = array(
|
176 |
+
'ID', 'user_login', 'user_pass',
|
177 |
+
'user_nicename', 'user_email', 'user_url',
|
178 |
+
'user_registered', /*'user_activation_key',*/ /*'user_status',*/
|
179 |
+
'display_name'
|
180 |
+
);
|
181 |
+
|
182 |
+
// compile final fields list ##
|
183 |
+
$fields = array_merge( $data_keys, $usermeta_fields, $bp_fields_passed );
|
184 |
+
|
185 |
+
// build the document headers ##
|
186 |
+
$headers = array();
|
187 |
+
foreach ( $fields as $key => $field ) {
|
188 |
+
|
189 |
+
// rename programs field ##
|
190 |
+
if ( $field == 'member_of_club' ){
|
191 |
+
$field = 'Program';
|
192 |
+
}
|
193 |
+
|
194 |
+
if ( in_array( $field, $exclude_data ) )
|
195 |
+
unset( $fields[$key] );
|
196 |
+
else
|
197 |
+
$headers[] = '"' . $field . '"';
|
198 |
+
|
199 |
+
}
|
200 |
+
|
201 |
+
// echo headers ##
|
202 |
+
echo implode( $seperator, $headers ) . $breaker;
|
203 |
+
|
204 |
+
// build row values for each user ##
|
205 |
+
foreach ( $users as $user ) {
|
206 |
+
|
207 |
+
$data = array();
|
208 |
+
foreach ( $fields as $field ) {
|
209 |
+
|
210 |
+
// BP loaded ? ##
|
211 |
+
if ( function_exists ('bp_is_active') ) {
|
212 |
+
$bp_data = BP_XProfile_ProfileData::get_all_for_user($user->ID);
|
213 |
+
}
|
214 |
+
|
215 |
+
// check if this is a BP field ##
|
216 |
+
if ( in_array( $field, $bp_fields_passed ) ) {
|
217 |
+
|
218 |
+
$value = $bp_data[$field];
|
219 |
+
|
220 |
+
if (is_array($value)) {
|
221 |
+
$value = $value['field_data'];
|
222 |
+
}
|
223 |
+
$value = $this->sanitize($value);
|
224 |
+
|
225 |
+
// user data or usermeta ##
|
226 |
+
} else {
|
227 |
+
|
228 |
+
$value = isset( $user->{$field} ) ? $user->{$field} : '';
|
229 |
+
$value = is_array( $value ) ? serialize( $value ) : $value;
|
230 |
+
|
231 |
+
}
|
232 |
+
|
233 |
+
// correct program value to Program Name ##
|
234 |
+
if ( $field == 'member_of_club' ){
|
235 |
+
$value = get_the_title($value);
|
236 |
+
}
|
237 |
+
|
238 |
+
$data[] = '"' . str_replace( '"', '""', $value ) . '"';
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
// echo row data ##
|
243 |
+
echo implode( $seperator, $data ) . $breaker;
|
244 |
+
}
|
245 |
+
|
246 |
+
// stop PHP, so file can export correctly ##
|
247 |
+
exit;
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Content of the settings page
|
253 |
+
*
|
254 |
+
* @since 0.1
|
255 |
+
**/
|
256 |
+
public function users_page() {
|
257 |
+
if ( ! current_user_can( 'list_users' ) ) {
|
258 |
+
wp_die( __( 'You do not have sufficient permissions to access this page.', 'export-user-data' ) );
|
259 |
+
}
|
260 |
+
?>
|
261 |
+
|
262 |
+
<div class="wrap">
|
263 |
+
<h2><?php _e( 'Export User Data', 'export-user-data' ); ?></h2>
|
264 |
+
<?php
|
265 |
+
|
266 |
+
// nothing happening? ##
|
267 |
+
if ( isset( $_GET['error'] ) ) {
|
268 |
+
echo '<div class="updated"><p><strong>' . __( 'No users found.', 'export-user-data' ) . '</strong></p></div>';
|
269 |
+
}
|
270 |
+
|
271 |
+
?>
|
272 |
+
<form method="post" action="" enctype="multipart/form-data">
|
273 |
+
<?php wp_nonce_field( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' ); ?>
|
274 |
+
<table class="form-table">
|
275 |
+
<?php
|
276 |
+
|
277 |
+
// allow admin to select user meta fields to export ##
|
278 |
+
global $wpdb;
|
279 |
+
$meta_keys = $wpdb->get_results( "SELECT distinct(meta_key) FROM $wpdb->usermeta" );
|
280 |
+
|
281 |
+
// get meta_key value from object ##
|
282 |
+
$meta_keys = wp_list_pluck( $meta_keys, 'meta_key' );
|
283 |
+
|
284 |
+
// let's ditch some of them odd keys ##
|
285 |
+
$meta_keys_drop = array(
|
286 |
+
'metaboxhidden',
|
287 |
+
'activation',
|
288 |
+
'bp_',
|
289 |
+
'nav_',
|
290 |
+
'wp_',
|
291 |
+
'admin_color',
|
292 |
+
'wpmudev',
|
293 |
+
'screen_',
|
294 |
+
'show_',
|
295 |
+
'rich_',
|
296 |
+
'reward_',
|
297 |
+
'meta-box',
|
298 |
+
'manageedit',
|
299 |
+
'edit_',
|
300 |
+
'closedpostboxes_',
|
301 |
+
'dismissed_',
|
302 |
+
'manage',
|
303 |
+
'comment',
|
304 |
+
'current',
|
305 |
+
'incentive_',
|
306 |
+
'_wdp',
|
307 |
+
'ssl',
|
308 |
+
'wdfb',
|
309 |
+
'users_per_page',
|
310 |
+
);
|
311 |
+
|
312 |
+
// allow array to be filtered ##
|
313 |
+
$meta_keys_drop = apply_filters( 'export_user_data_meta_keys_drop', $meta_keys_drop );
|
314 |
+
|
315 |
+
foreach ( $meta_keys as $key ) {
|
316 |
+
|
317 |
+
foreach ( $meta_keys_drop as $drop ) {
|
318 |
+
|
319 |
+
if ( strpos( $key, $drop ) !== false ) {
|
320 |
+
|
321 |
+
#echo 'FOUND -- '.$drop.' in '.$key.'<br />';
|
322 |
+
|
323 |
+
if(($key = array_search($key, $meta_keys)) !== false) {
|
324 |
+
unset($meta_keys[$key]);
|
325 |
+
}
|
326 |
+
|
327 |
+
}
|
328 |
+
|
329 |
+
}
|
330 |
+
|
331 |
+
}
|
332 |
+
|
333 |
+
// test array ##
|
334 |
+
#echo '<pre>'; var_dump($meta_keys); echo '</pre>';
|
335 |
+
|
336 |
+
// check if we got anything ? ##
|
337 |
+
if ( $meta_keys ) {
|
338 |
+
|
339 |
+
?>
|
340 |
+
<tr valign="top">
|
341 |
+
<th scope="row"><label for="q_eud_usermeta"><?php _e( 'User Meta Fields', 'export-user-data' ); ?></label></th>
|
342 |
+
<td>
|
343 |
+
<?php
|
344 |
+
|
345 |
+
foreach ( $meta_keys as $key ) {
|
346 |
+
|
347 |
+
#echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
348 |
+
|
349 |
+
// display $key ##
|
350 |
+
$display_key = $key;
|
351 |
+
|
352 |
+
// rename programs field ##
|
353 |
+
if ( $display_key == 'member_of_club' ){
|
354 |
+
$display_key = 'program';
|
355 |
+
}
|
356 |
+
|
357 |
+
// tidy ##
|
358 |
+
$display_key = str_replace( "_", " ", ucwords($display_key) );
|
359 |
+
|
360 |
+
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 />";
|
361 |
+
}
|
362 |
+
?>
|
363 |
+
</td>
|
364 |
+
</tr>
|
365 |
+
<?php
|
366 |
+
|
367 |
+
} // meta_keys found ##
|
368 |
+
|
369 |
+
?>
|
370 |
+
<?php
|
371 |
+
|
372 |
+
// buddypress x profile data ##
|
373 |
+
if ( function_exists ('bp_is_active') ) {
|
374 |
+
|
375 |
+
// grab all buddypress x profile fields ##
|
376 |
+
$bp_fields = $wpdb->get_results( "SELECT distinct(name) FROM ".$wpdb->base_prefix."bp_xprofile_fields WHERE parent_id = 0" );
|
377 |
+
|
378 |
+
// get name value from object ##
|
379 |
+
$bp_fields = wp_list_pluck( $bp_fields, 'name' );
|
380 |
+
|
381 |
+
// test array ##
|
382 |
+
#echo '<pre>'; var_dump($bp_fields); echo '</pre>';
|
383 |
+
|
384 |
+
// allow array to be filtered ##
|
385 |
+
$bp_fields = apply_filters( 'export_user_data_bp_fields', $bp_fields );
|
386 |
+
|
387 |
+
?>
|
388 |
+
<tr valign="top">
|
389 |
+
<th scope="row"><label for="q_eud_xprofile"><?php _e( 'BP xProfile Fields', 'export-user-data' ); ?></label></th>
|
390 |
+
<td>
|
391 |
+
<?php
|
392 |
+
|
393 |
+
foreach ( $bp_fields as $key ) {
|
394 |
+
|
395 |
+
// tidy up key ##
|
396 |
+
$key_tidy = str_replace( ' ', '__', ($key));
|
397 |
+
|
398 |
+
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 />";
|
399 |
+
}
|
400 |
+
?>
|
401 |
+
</td>
|
402 |
+
</tr>
|
403 |
+
<?php
|
404 |
+
|
405 |
+
} // BP installed and active ##
|
406 |
+
|
407 |
+
?>
|
408 |
+
<tr valign="top">
|
409 |
+
<th scope="row"><label for="q_eud_users_role"><?php _e( 'Role', 'export-user-data' ); ?></label></th>
|
410 |
+
<td>
|
411 |
+
<select name="role" id="q_eud_users_role">
|
412 |
+
<?php
|
413 |
+
|
414 |
+
echo '<option value="">' . __( 'All Roles', 'export-user-data' ) . '</option>';
|
415 |
+
global $wp_roles;
|
416 |
+
foreach ( $wp_roles->role_names as $role => $name ) {
|
417 |
+
echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
418 |
+
}
|
419 |
+
|
420 |
+
?>
|
421 |
+
</select>
|
422 |
+
</td>
|
423 |
+
</tr>
|
424 |
+
<?php
|
425 |
+
|
426 |
+
// clubs ? ##
|
427 |
+
if ( post_type_exists( 'club' ) ) {
|
428 |
+
|
429 |
+
?>
|
430 |
+
<tr valign="top">
|
431 |
+
<th scope="row"><label for="q_eud_users_program"><?php _e( 'Programs', 'export-user-data' ); ?></label></th>
|
432 |
+
<td>
|
433 |
+
<select name="program" id="q_eud_users_program">
|
434 |
+
<?php
|
435 |
+
|
436 |
+
echo '<option value="">' . __( 'All Programs', 'export-user-data' ) . '</option>';
|
437 |
+
|
438 |
+
$clubs_array = get_posts(array( 'post_type'=> 'club', 'posts_per_page' => -1 )); // grab all posts of type "club" ##
|
439 |
+
|
440 |
+
foreach ( $clubs_array as $c ) { // loop over all clubs ##
|
441 |
+
|
442 |
+
#$clubs[$c->ID] = $c; // grab club ID ##
|
443 |
+
echo "\n\t<option value='" . esc_attr( $c->ID ) . "'>$c->post_title</option>";
|
444 |
+
|
445 |
+
}
|
446 |
+
|
447 |
+
?>
|
448 |
+
</select>
|
449 |
+
</td>
|
450 |
+
</tr>
|
451 |
+
<?php
|
452 |
+
|
453 |
+
} // clubs ##
|
454 |
+
|
455 |
+
?>
|
456 |
+
<tr valign="top">
|
457 |
+
<th scope="row"><label><?php _e( 'Registred', 'export-user-data' ); ?></label></th>
|
458 |
+
<td>
|
459 |
+
<select name="start_date" id="q_eud_users_start_date">
|
460 |
+
<option value="0"><?php _e( 'Start Date', 'export-user-data' ); ?></option>
|
461 |
+
<?php $this->export_date_options(); ?>
|
462 |
+
</select>
|
463 |
+
<select name="end_date" id="q_eud_users_end_date">
|
464 |
+
<option value="0"><?php _e( 'End Date', 'export-user-data' ); ?></option>
|
465 |
+
<?php $this->export_date_options(); ?>
|
466 |
+
</select>
|
467 |
+
</td>
|
468 |
+
</tr>
|
469 |
+
|
470 |
+
<tr valign="top">
|
471 |
+
<th scope="row"><label for="q_eud_users_format"><?php _e( 'Format', 'export-user-data' ); ?></label></th>
|
472 |
+
<td>
|
473 |
+
<select name="format" id="q_eud_users_format">
|
474 |
+
<?php
|
475 |
+
|
476 |
+
echo '<option value="excel">' . __( 'Excel', 'export-user-data' ) . '</option>';
|
477 |
+
echo '<option value="csv">' . __( 'CSV', 'export-user-data' ) . '</option>';
|
478 |
+
|
479 |
+
?>
|
480 |
+
</select>
|
481 |
+
</td>
|
482 |
+
</tr>
|
483 |
+
</table>
|
484 |
+
<p class="submit">
|
485 |
+
<input type="hidden" name="_wp_http_referer" value="<?php echo $_SERVER['REQUEST_URI'] ?>" />
|
486 |
+
<input type="submit" class="button-primary" value="<?php _e( 'Export', 'export-user-data' ); ?>" />
|
487 |
+
</p>
|
488 |
+
</form>
|
489 |
+
<?php
|
490 |
+
}
|
491 |
+
|
492 |
+
// data to exclude from export ##
|
493 |
+
public function exclude_data() {
|
494 |
+
$exclude = array( 'user_pass', 'user_activation_key' );
|
495 |
+
return $exclude;
|
496 |
+
}
|
497 |
+
|
498 |
+
public function pre_user_query( $user_search ) {
|
499 |
+
global $wpdb;
|
500 |
+
|
501 |
+
$where = '';
|
502 |
+
|
503 |
+
if ( ! empty( $_POST['start_date'] ) )
|
504 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered >= %s", date( 'Y-m-d', strtotime( $_POST['start_date'] ) ) );
|
505 |
+
|
506 |
+
if ( ! empty( $_POST['end_date'] ) )
|
507 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $_POST['end_date'] ) ) ) );
|
508 |
+
|
509 |
+
if ( ! empty( $where ) )
|
510 |
+
$user_search->query_where = str_replace( 'WHERE 1=1', "WHERE 1=1 $where", $user_search->query_where );
|
511 |
+
|
512 |
+
return $user_search;
|
513 |
+
}
|
514 |
+
|
515 |
+
private function export_date_options() {
|
516 |
+
global $wpdb, $wp_locale;
|
517 |
+
|
518 |
+
$months = $wpdb->get_results( "
|
519 |
+
SELECT DISTINCT YEAR( user_registered ) AS year, MONTH( user_registered ) AS month
|
520 |
+
FROM $wpdb->users
|
521 |
+
ORDER BY user_registered DESC
|
522 |
+
" );
|
523 |
+
|
524 |
+
$month_count = count( $months );
|
525 |
+
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
|
526 |
+
return;
|
527 |
+
|
528 |
+
foreach ( $months as $date ) {
|
529 |
+
if ( 0 == $date->year )
|
530 |
+
continue;
|
531 |
+
|
532 |
+
$month = zeroise( $date->month, 2 );
|
533 |
+
echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';
|
534 |
+
}
|
535 |
+
}
|
536 |
+
}
|
537 |
+
|
538 |
+
new Q_EUD_Export_Users;
|
tags/0.5.2/languages/default.mo
ADDED
Binary file
|
tags/0.5.2/languages/default.po
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.5.4\n"
|
14 |
+
"X-Poedit-KeywordsList: _;_e;_n;__\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
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 ""
|
tags/0.5.2/readme.txt
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
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.5.2
|
7 |
+
License: GPLv2
|
8 |
+
Original: http://wordpress.org/plugins/export-users-to-csv/
|
9 |
+
|
10 |
+
Export users data, metadata and buddypress xprofile data to a csv or Excel file
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
A plugin that exports ALL user data, meta data and BuddyPress xProfile data.
|
15 |
+
|
16 |
+
Includes an option to export the users by role, registration date range, usermeta option and two export formats.
|
17 |
+
|
18 |
+
= Features =
|
19 |
+
|
20 |
+
* Exports all users fields
|
21 |
+
* Exports users meta
|
22 |
+
* Exports users by role
|
23 |
+
* Exports users by date range
|
24 |
+
* Export user BuddyPress xProfile data
|
25 |
+
|
26 |
+
For feature request and bug reports, [please use the forums](http://wordpress.org/tags/export-users-data).
|
27 |
+
|
28 |
+
== Installation ==
|
29 |
+
|
30 |
+
For an automatic installation through WordPress:
|
31 |
+
|
32 |
+
1. Go to the 'Add New' plugins screen in your WordPress admin area
|
33 |
+
1. Search for 'Export User Data'
|
34 |
+
1. Click 'Install Now' and activate the plugin
|
35 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
36 |
+
|
37 |
+
|
38 |
+
For a manual installation via FTP:
|
39 |
+
|
40 |
+
1. Upload the `export-user-data` directory to the `/wp-content/plugins/` directory
|
41 |
+
1. Activate the plugin through the 'Plugins' screen in your WordPress admin area
|
42 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
43 |
+
|
44 |
+
|
45 |
+
To upload the plugin through WordPress, instead of FTP:
|
46 |
+
|
47 |
+
1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
|
48 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
49 |
+
|
50 |
+
== Frequently Asked Questions ==
|
51 |
+
|
52 |
+
= How to use? =
|
53 |
+
|
54 |
+
Click on the 'Export User Data' link in the 'Users' menu, choose the role and the date range or don't select anything if you want to export all users, then click 'Export'. That's all!
|
55 |
+
|
56 |
+
== Screenshots ==
|
57 |
+
|
58 |
+
1. User export screen
|
59 |
+
|
60 |
+
== Changelog ==
|
61 |
+
|
62 |
+
= 0.5 =
|
63 |
+
* First public release.
|
64 |
+
|
65 |
+
== Upgrade Notice ==
|
66 |
+
|
67 |
+
= 0.5 =
|
68 |
+
First release.
|
tags/0.5.2/screenshot-1.png
ADDED
Binary file
|
tags/0.5.3/export-user-data.php
ADDED
@@ -0,0 +1,541 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Export_User_Data
|
4 |
+
* @version 0.5.2
|
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.5.3
|
11 |
+
Author: Q Studio
|
12 |
+
Author URI: http://qstudio.us/
|
13 |
+
License: GPL2
|
14 |
+
Text Domain: export-user-data
|
15 |
+
*/
|
16 |
+
|
17 |
+
/*
|
18 |
+
* Based on: Export User to CSV by PubPoet ( http://pubpoet.com/ )- Thanks!
|
19 |
+
*/
|
20 |
+
|
21 |
+
load_plugin_textdomain( 'export-user-data', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Main plugin class
|
25 |
+
*
|
26 |
+
* @since 0.1
|
27 |
+
**/
|
28 |
+
class Q_EUD_Export_Users {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Class contructor
|
32 |
+
*
|
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);
|
53 |
+
$value = str_replace("\n", '', $value);
|
54 |
+
$value = str_replace("\t", '', $value);
|
55 |
+
return $value;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Process content of CSV file
|
60 |
+
*
|
61 |
+
* @since 0.1
|
62 |
+
**/
|
63 |
+
public function generate_data() {
|
64 |
+
if ( isset( $_POST['_wpnonce-q-eud-export-user-page_export'] ) ) {
|
65 |
+
check_admin_referer( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' );
|
66 |
+
|
67 |
+
// build argument array ##
|
68 |
+
$args = array(
|
69 |
+
'fields' => 'all_with_meta',
|
70 |
+
'role' => stripslashes( $_POST['role'] )
|
71 |
+
);
|
72 |
+
|
73 |
+
// did the user request a specific program ? ##
|
74 |
+
if ( isset( $_POST['program'] ) && $_POST['program'] != '' ) {
|
75 |
+
|
76 |
+
$args['meta_key'] = 'member_of_club';
|
77 |
+
$args['meta_value'] = (int)$_POST['program'];
|
78 |
+
$args['meta_compare'] = '=';
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
add_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
83 |
+
$users = get_users( $args );
|
84 |
+
remove_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
85 |
+
|
86 |
+
if ( ! $users ) {
|
87 |
+
$referer = add_query_arg( 'error', 'empty', wp_get_referer() );
|
88 |
+
wp_redirect( $referer );
|
89 |
+
exit;
|
90 |
+
}
|
91 |
+
|
92 |
+
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
93 |
+
if ( ! empty( $sitename ) )
|
94 |
+
$sitename .= '.';
|
95 |
+
|
96 |
+
// export method ? ##
|
97 |
+
$export_method = 'excel'; // default to Excel export ##
|
98 |
+
if ( isset( $_POST['format'] ) && $_POST['format'] != '' ) {
|
99 |
+
|
100 |
+
$export_method = $_POST['format'];
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
// set export filename structure ##
|
105 |
+
$filename = $sitename . 'users.' . date( 'Y-m-d-H-i-s' );
|
106 |
+
|
107 |
+
switch ( $export_method ) {
|
108 |
+
|
109 |
+
case "csv":
|
110 |
+
|
111 |
+
// to csv ##
|
112 |
+
header( 'Content-Description: File Transfer' );
|
113 |
+
header( 'Content-Disposition: attachment; filename='.$filename.'.csv' );
|
114 |
+
header( 'Content-Type: text/csv; charset=' . get_option( 'blog_charset' ), true );
|
115 |
+
|
116 |
+
// how to seperate data ##
|
117 |
+
$seperator = ','; // comma for csv ##
|
118 |
+
|
119 |
+
break;
|
120 |
+
|
121 |
+
case ('excel'):
|
122 |
+
|
123 |
+
// to xls ##
|
124 |
+
header( 'Content-Description: File Transfer' );
|
125 |
+
header("Content-Type: application/vnd.ms-excel");
|
126 |
+
header("Content-Disposition: attachment; filename=$filename.xls");
|
127 |
+
header("Pragma: no-cache");
|
128 |
+
header("Expires: 0");
|
129 |
+
|
130 |
+
// how to seperate data ##
|
131 |
+
$seperator = "\t"; //tabbed character
|
132 |
+
|
133 |
+
break;
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
// line break ##
|
138 |
+
$breaker = "\n";
|
139 |
+
|
140 |
+
// function to exclude data ##
|
141 |
+
$exclude_data = apply_filters( 'q_eud_exclude_data', array() );
|
142 |
+
|
143 |
+
// check for selected usermeta fields ##
|
144 |
+
$usermeta = $_POST['usermeta'];
|
145 |
+
$usermeta_fields = array();
|
146 |
+
foreach( $usermeta as $field ) {
|
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();
|
164 |
+
foreach( $bp_fields as $field ) {
|
165 |
+
|
166 |
+
// reverse tidy ##
|
167 |
+
$field = str_replace( '__', ' ', $field );
|
168 |
+
|
169 |
+
// add to array ##
|
170 |
+
$bp_fields_passed[] = $field;
|
171 |
+
|
172 |
+
}
|
173 |
+
|
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',
|
181 |
+
'user_registered', /*'user_activation_key',*/ /*'user_status',*/
|
182 |
+
'display_name'
|
183 |
+
);
|
184 |
+
|
185 |
+
// compile final fields list ##
|
186 |
+
$fields = array_merge( $data_keys, $usermeta_fields, $bp_fields_passed );
|
187 |
+
|
188 |
+
// build the document headers ##
|
189 |
+
$headers = array();
|
190 |
+
foreach ( $fields as $key => $field ) {
|
191 |
+
|
192 |
+
// rename programs field ##
|
193 |
+
if ( $field == 'member_of_club' ){
|
194 |
+
$field = 'Program';
|
195 |
+
}
|
196 |
+
|
197 |
+
if ( in_array( $field, $exclude_data ) )
|
198 |
+
unset( $fields[$key] );
|
199 |
+
else
|
200 |
+
$headers[] = '"' . $field . '"';
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
// echo headers ##
|
205 |
+
echo implode( $seperator, $headers ) . $breaker;
|
206 |
+
|
207 |
+
// build row values for each user ##
|
208 |
+
foreach ( $users as $user ) {
|
209 |
+
|
210 |
+
$data = array();
|
211 |
+
foreach ( $fields as $field ) {
|
212 |
+
|
213 |
+
// BP loaded ? ##
|
214 |
+
if ( function_exists ('bp_is_active') ) {
|
215 |
+
$bp_data = BP_XProfile_ProfileData::get_all_for_user($user->ID);
|
216 |
+
}
|
217 |
+
|
218 |
+
// check if this is a BP field ##
|
219 |
+
if ( in_array( $field, $bp_fields_passed ) ) {
|
220 |
+
|
221 |
+
$value = $bp_data[$field];
|
222 |
+
|
223 |
+
if (is_array($value)) {
|
224 |
+
$value = $value['field_data'];
|
225 |
+
}
|
226 |
+
$value = $this->sanitize($value);
|
227 |
+
|
228 |
+
// user data or usermeta ##
|
229 |
+
} else {
|
230 |
+
|
231 |
+
$value = isset( $user->{$field} ) ? $user->{$field} : '';
|
232 |
+
$value = is_array( $value ) ? serialize( $value ) : $value;
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
// correct program value to Program Name ##
|
237 |
+
if ( $field == 'member_of_club' ){
|
238 |
+
$value = get_the_title($value);
|
239 |
+
}
|
240 |
+
|
241 |
+
$data[] = '"' . str_replace( '"', '""', $value ) . '"';
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
// echo row data ##
|
246 |
+
echo implode( $seperator, $data ) . $breaker;
|
247 |
+
}
|
248 |
+
|
249 |
+
// stop PHP, so file can export correctly ##
|
250 |
+
exit;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Content of the settings page
|
256 |
+
*
|
257 |
+
* @since 0.1
|
258 |
+
**/
|
259 |
+
public function users_page() {
|
260 |
+
if ( ! current_user_can( 'list_users' ) ) {
|
261 |
+
wp_die( __( 'You do not have sufficient permissions to access this page.', 'export-user-data' ) );
|
262 |
+
}
|
263 |
+
?>
|
264 |
+
|
265 |
+
<div class="wrap">
|
266 |
+
<h2><?php _e( 'Export User Data', 'export-user-data' ); ?></h2>
|
267 |
+
<?php
|
268 |
+
|
269 |
+
// nothing happening? ##
|
270 |
+
if ( isset( $_GET['error'] ) ) {
|
271 |
+
echo '<div class="updated"><p><strong>' . __( 'No users found.', 'export-user-data' ) . '</strong></p></div>';
|
272 |
+
}
|
273 |
+
|
274 |
+
?>
|
275 |
+
<form method="post" action="" enctype="multipart/form-data">
|
276 |
+
<?php wp_nonce_field( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' ); ?>
|
277 |
+
<table class="form-table">
|
278 |
+
<?php
|
279 |
+
|
280 |
+
// allow admin to select user meta fields to export ##
|
281 |
+
global $wpdb;
|
282 |
+
$meta_keys = $wpdb->get_results( "SELECT distinct(meta_key) FROM $wpdb->usermeta" );
|
283 |
+
|
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_',
|
292 |
+
'nav_',
|
293 |
+
'wp_',
|
294 |
+
'admin_color',
|
295 |
+
'wpmudev',
|
296 |
+
'screen_',
|
297 |
+
'show_',
|
298 |
+
'rich_',
|
299 |
+
'reward_',
|
300 |
+
'meta-box',
|
301 |
+
'manageedit',
|
302 |
+
'edit_',
|
303 |
+
'closedpostboxes_',
|
304 |
+
'dismissed_',
|
305 |
+
'manage',
|
306 |
+
'comment',
|
307 |
+
'current',
|
308 |
+
'incentive_',
|
309 |
+
'_wdp',
|
310 |
+
'ssl',
|
311 |
+
'wdfb',
|
312 |
+
'users_per_page',
|
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 |
+
|
324 |
+
#echo 'FOUND -- '.$drop.' in '.$key.'<br />';
|
325 |
+
|
326 |
+
if(($key = array_search($key, $meta_keys)) !== false) {
|
327 |
+
unset($meta_keys[$key]);
|
328 |
+
}
|
329 |
+
|
330 |
+
}
|
331 |
+
|
332 |
+
}
|
333 |
+
|
334 |
+
}
|
335 |
+
|
336 |
+
// test array ##
|
337 |
+
#echo '<pre>'; var_dump($meta_keys); echo '</pre>';
|
338 |
+
|
339 |
+
// check if we got anything ? ##
|
340 |
+
if ( $meta_keys ) {
|
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
|
369 |
+
|
370 |
+
} // meta_keys found ##
|
371 |
+
|
372 |
+
?>
|
373 |
+
<?php
|
374 |
+
|
375 |
+
// buddypress x profile data ##
|
376 |
+
if ( function_exists ('bp_is_active') ) {
|
377 |
+
|
378 |
+
// grab all buddypress x profile fields ##
|
379 |
+
$bp_fields = $wpdb->get_results( "SELECT distinct(name) FROM ".$wpdb->base_prefix."bp_xprofile_fields WHERE parent_id = 0" );
|
380 |
+
|
381 |
+
// get name value from object ##
|
382 |
+
$bp_fields = wp_list_pluck( $bp_fields, 'name' );
|
383 |
+
|
384 |
+
// test array ##
|
385 |
+
#echo '<pre>'; var_dump($bp_fields); echo '</pre>';
|
386 |
+
|
387 |
+
// allow array to be filtered ##
|
388 |
+
$bp_fields = apply_filters( 'export_user_data_bp_fields', $bp_fields );
|
389 |
+
|
390 |
+
?>
|
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 ) {
|
397 |
+
|
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
|
407 |
+
|
408 |
+
} // BP installed and active ##
|
409 |
+
|
410 |
+
?>
|
411 |
+
<tr valign="top">
|
412 |
+
<th scope="row"><label for="q_eud_users_role"><?php _e( 'Role', 'export-user-data' ); ?></label></th>
|
413 |
+
<td>
|
414 |
+
<select name="role" id="q_eud_users_role">
|
415 |
+
<?php
|
416 |
+
|
417 |
+
echo '<option value="">' . __( 'All Roles', 'export-user-data' ) . '</option>';
|
418 |
+
global $wp_roles;
|
419 |
+
foreach ( $wp_roles->role_names as $role => $name ) {
|
420 |
+
echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
421 |
+
}
|
422 |
+
|
423 |
+
?>
|
424 |
+
</select>
|
425 |
+
</td>
|
426 |
+
</tr>
|
427 |
+
<?php
|
428 |
+
|
429 |
+
// clubs ? ##
|
430 |
+
if ( post_type_exists( 'club' ) ) {
|
431 |
+
|
432 |
+
?>
|
433 |
+
<tr valign="top">
|
434 |
+
<th scope="row"><label for="q_eud_users_program"><?php _e( 'Programs', 'export-user-data' ); ?></label></th>
|
435 |
+
<td>
|
436 |
+
<select name="program" id="q_eud_users_program">
|
437 |
+
<?php
|
438 |
+
|
439 |
+
echo '<option value="">' . __( 'All Programs', 'export-user-data' ) . '</option>';
|
440 |
+
|
441 |
+
$clubs_array = get_posts(array( 'post_type'=> 'club', 'posts_per_page' => -1 )); // grab all posts of type "club" ##
|
442 |
+
|
443 |
+
foreach ( $clubs_array as $c ) { // loop over all clubs ##
|
444 |
+
|
445 |
+
#$clubs[$c->ID] = $c; // grab club ID ##
|
446 |
+
echo "\n\t<option value='" . esc_attr( $c->ID ) . "'>$c->post_title</option>";
|
447 |
+
|
448 |
+
}
|
449 |
+
|
450 |
+
?>
|
451 |
+
</select>
|
452 |
+
</td>
|
453 |
+
</tr>
|
454 |
+
<?php
|
455 |
+
|
456 |
+
} // clubs ##
|
457 |
+
|
458 |
+
?>
|
459 |
+
<tr valign="top">
|
460 |
+
<th scope="row"><label><?php _e( 'Registred', 'export-user-data' ); ?></label></th>
|
461 |
+
<td>
|
462 |
+
<select name="start_date" id="q_eud_users_start_date">
|
463 |
+
<option value="0"><?php _e( 'Start Date', 'export-user-data' ); ?></option>
|
464 |
+
<?php $this->export_date_options(); ?>
|
465 |
+
</select>
|
466 |
+
<select name="end_date" id="q_eud_users_end_date">
|
467 |
+
<option value="0"><?php _e( 'End Date', 'export-user-data' ); ?></option>
|
468 |
+
<?php $this->export_date_options(); ?>
|
469 |
+
</select>
|
470 |
+
</td>
|
471 |
+
</tr>
|
472 |
+
|
473 |
+
<tr valign="top">
|
474 |
+
<th scope="row"><label for="q_eud_users_format"><?php _e( 'Format', 'export-user-data' ); ?></label></th>
|
475 |
+
<td>
|
476 |
+
<select name="format" id="q_eud_users_format">
|
477 |
+
<?php
|
478 |
+
|
479 |
+
echo '<option value="excel">' . __( 'Excel', 'export-user-data' ) . '</option>';
|
480 |
+
echo '<option value="csv">' . __( 'CSV', 'export-user-data' ) . '</option>';
|
481 |
+
|
482 |
+
?>
|
483 |
+
</select>
|
484 |
+
</td>
|
485 |
+
</tr>
|
486 |
+
</table>
|
487 |
+
<p class="submit">
|
488 |
+
<input type="hidden" name="_wp_http_referer" value="<?php echo $_SERVER['REQUEST_URI'] ?>" />
|
489 |
+
<input type="submit" class="button-primary" value="<?php _e( 'Export', 'export-user-data' ); ?>" />
|
490 |
+
</p>
|
491 |
+
</form>
|
492 |
+
<?php
|
493 |
+
}
|
494 |
+
|
495 |
+
// data to exclude from export ##
|
496 |
+
public function exclude_data() {
|
497 |
+
$exclude = array( 'user_pass', 'user_activation_key' );
|
498 |
+
return $exclude;
|
499 |
+
}
|
500 |
+
|
501 |
+
public function pre_user_query( $user_search ) {
|
502 |
+
global $wpdb;
|
503 |
+
|
504 |
+
$where = '';
|
505 |
+
|
506 |
+
if ( ! empty( $_POST['start_date'] ) )
|
507 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered >= %s", date( 'Y-m-d', strtotime( $_POST['start_date'] ) ) );
|
508 |
+
|
509 |
+
if ( ! empty( $_POST['end_date'] ) )
|
510 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $_POST['end_date'] ) ) ) );
|
511 |
+
|
512 |
+
if ( ! empty( $where ) )
|
513 |
+
$user_search->query_where = str_replace( 'WHERE 1=1', "WHERE 1=1 $where", $user_search->query_where );
|
514 |
+
|
515 |
+
return $user_search;
|
516 |
+
}
|
517 |
+
|
518 |
+
private function export_date_options() {
|
519 |
+
global $wpdb, $wp_locale;
|
520 |
+
|
521 |
+
$months = $wpdb->get_results( "
|
522 |
+
SELECT DISTINCT YEAR( user_registered ) AS year, MONTH( user_registered ) AS month
|
523 |
+
FROM $wpdb->users
|
524 |
+
ORDER BY user_registered DESC
|
525 |
+
" );
|
526 |
+
|
527 |
+
$month_count = count( $months );
|
528 |
+
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
|
529 |
+
return;
|
530 |
+
|
531 |
+
foreach ( $months as $date ) {
|
532 |
+
if ( 0 == $date->year )
|
533 |
+
continue;
|
534 |
+
|
535 |
+
$month = zeroise( $date->month, 2 );
|
536 |
+
echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';
|
537 |
+
}
|
538 |
+
}
|
539 |
+
}
|
540 |
+
|
541 |
+
new Q_EUD_Export_Users;
|
tags/0.5.3/languages/default.mo
ADDED
Binary file
|
tags/0.5.3/languages/default.po
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.5.4\n"
|
14 |
+
"X-Poedit-KeywordsList: _;_e;_n;__\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
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 ""
|
tags/0.5.3/readme.txt
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
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.5.3
|
7 |
+
License: GPLv2
|
8 |
+
|
9 |
+
Export users data, metadata and buddypress xprofile data to a csv or Excel file
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
A plugin that exports ALL user data, meta data and BuddyPress xProfile data.
|
14 |
+
|
15 |
+
Includes an option to export the users by role, registration date range, usermeta option and two export formats.
|
16 |
+
|
17 |
+
Based on: http://wordpress.org/plugins/export-users-to-csv/
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* Exports all users fields
|
22 |
+
* Exports users meta
|
23 |
+
* Exports users by role
|
24 |
+
* Exports users by date range
|
25 |
+
* Export user BuddyPress xProfile data
|
26 |
+
|
27 |
+
For feature request and bug reports, [please use the forums](http://wordpress.org/tags/export-users-data).
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
For an automatic installation through WordPress:
|
32 |
+
|
33 |
+
1. Go to the 'Add New' plugins screen in your WordPress admin area
|
34 |
+
1. Search for 'Export User Data'
|
35 |
+
1. Click 'Install Now' and activate the plugin
|
36 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
37 |
+
|
38 |
+
|
39 |
+
For a manual installation via FTP:
|
40 |
+
|
41 |
+
1. Upload the `export-user-data` directory to the `/wp-content/plugins/` directory
|
42 |
+
1. Activate the plugin through the 'Plugins' screen in your WordPress admin area
|
43 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
44 |
+
|
45 |
+
|
46 |
+
To upload the plugin through WordPress, instead of FTP:
|
47 |
+
|
48 |
+
1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
|
49 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
50 |
+
|
51 |
+
== Frequently Asked Questions ==
|
52 |
+
|
53 |
+
= How to use? =
|
54 |
+
|
55 |
+
Click on the 'Export User Data' link in the 'Users' menu, choose the role and the date range or don't select anything if you want to export all users, then click 'Export'. That's all!
|
56 |
+
|
57 |
+
== Screenshots ==
|
58 |
+
|
59 |
+
1. User export screen
|
60 |
+
|
61 |
+
== Changelog ==
|
62 |
+
|
63 |
+
= 0.5 =
|
64 |
+
* First public release.
|
65 |
+
|
66 |
+
== Upgrade Notice ==
|
67 |
+
|
68 |
+
= 0.5 =
|
69 |
+
First release.
|
tags/0.5.3/screenshot-1.png
ADDED
Binary file
|
tags/0.6.1/export-user-data.php
ADDED
@@ -0,0 +1,541 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
14 |
+
Text Domain: export-user-data
|
15 |
+
*/
|
16 |
+
|
17 |
+
/*
|
18 |
+
* Based on: Export User to CSV by PubPoet ( http://pubpoet.com/ )- Thanks!
|
19 |
+
*/
|
20 |
+
|
21 |
+
load_plugin_textdomain( 'export-user-data', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Main plugin class
|
25 |
+
*
|
26 |
+
* @since 0.1
|
27 |
+
**/
|
28 |
+
class Q_EUD_Export_Users {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Class contructor
|
32 |
+
*
|
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);
|
53 |
+
$value = str_replace("\n", '', $value);
|
54 |
+
$value = str_replace("\t", '', $value);
|
55 |
+
return $value;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Process content of CSV file
|
60 |
+
*
|
61 |
+
* @since 0.1
|
62 |
+
**/
|
63 |
+
public function generate_data() {
|
64 |
+
if ( isset( $_POST['_wpnonce-q-eud-export-user-page_export'] ) ) {
|
65 |
+
check_admin_referer( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' );
|
66 |
+
|
67 |
+
// build argument array ##
|
68 |
+
$args = array(
|
69 |
+
'fields' => 'all_with_meta',
|
70 |
+
'role' => stripslashes( $_POST['role'] )
|
71 |
+
);
|
72 |
+
|
73 |
+
// did the user request a specific program ? ##
|
74 |
+
if ( isset( $_POST['program'] ) && $_POST['program'] != '' ) {
|
75 |
+
|
76 |
+
$args['meta_key'] = 'member_of_club';
|
77 |
+
$args['meta_value'] = (int)$_POST['program'];
|
78 |
+
$args['meta_compare'] = '=';
|
79 |
+
|
80 |
+
}
|
81 |
+
|
82 |
+
add_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
83 |
+
$users = get_users( $args );
|
84 |
+
remove_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
85 |
+
|
86 |
+
if ( ! $users ) {
|
87 |
+
$referer = add_query_arg( 'error', 'empty', wp_get_referer() );
|
88 |
+
wp_redirect( $referer );
|
89 |
+
exit;
|
90 |
+
}
|
91 |
+
|
92 |
+
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
93 |
+
if ( ! empty( $sitename ) )
|
94 |
+
$sitename .= '.';
|
95 |
+
|
96 |
+
// export method ? ##
|
97 |
+
$export_method = 'excel'; // default to Excel export ##
|
98 |
+
if ( isset( $_POST['format'] ) && $_POST['format'] != '' ) {
|
99 |
+
|
100 |
+
$export_method = $_POST['format'];
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
// set export filename structure ##
|
105 |
+
$filename = $sitename . 'users.' . date( 'Y-m-d-H-i-s' );
|
106 |
+
|
107 |
+
switch ( $export_method ) {
|
108 |
+
|
109 |
+
case "csv":
|
110 |
+
|
111 |
+
// to csv ##
|
112 |
+
header( 'Content-Description: File Transfer' );
|
113 |
+
header( 'Content-Disposition: attachment; filename='.$filename.'.csv' );
|
114 |
+
header( 'Content-Type: text/csv; charset=' . get_option( 'blog_charset' ), true );
|
115 |
+
|
116 |
+
// how to seperate data ##
|
117 |
+
$seperator = ','; // comma for csv ##
|
118 |
+
|
119 |
+
break;
|
120 |
+
|
121 |
+
case ('excel'):
|
122 |
+
|
123 |
+
// to xls ##
|
124 |
+
header( 'Content-Description: File Transfer' );
|
125 |
+
header("Content-Type: application/vnd.ms-excel");
|
126 |
+
header("Content-Disposition: attachment; filename=$filename.xls");
|
127 |
+
header("Pragma: no-cache");
|
128 |
+
header("Expires: 0");
|
129 |
+
|
130 |
+
// how to seperate data ##
|
131 |
+
$seperator = "\t"; //tabbed character
|
132 |
+
|
133 |
+
break;
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
// line break ##
|
138 |
+
$breaker = "\n";
|
139 |
+
|
140 |
+
// function to exclude data ##
|
141 |
+
$exclude_data = apply_filters( 'q_eud_exclude_data', array() );
|
142 |
+
|
143 |
+
// check for selected usermeta fields ##
|
144 |
+
$usermeta = $_POST['usermeta'];
|
145 |
+
$usermeta_fields = array();
|
146 |
+
foreach( $usermeta as $field ) {
|
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();
|
164 |
+
foreach( $bp_fields as $field ) {
|
165 |
+
|
166 |
+
// reverse tidy ##
|
167 |
+
$field = str_replace( '__', ' ', $field );
|
168 |
+
|
169 |
+
// add to array ##
|
170 |
+
$bp_fields_passed[] = $field;
|
171 |
+
|
172 |
+
}
|
173 |
+
|
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',
|
181 |
+
'user_registered', /*'user_activation_key',*/ /*'user_status',*/
|
182 |
+
'display_name'
|
183 |
+
);
|
184 |
+
|
185 |
+
// compile final fields list ##
|
186 |
+
$fields = array_merge( $data_keys, $usermeta_fields, $bp_fields_passed );
|
187 |
+
|
188 |
+
// build the document headers ##
|
189 |
+
$headers = array();
|
190 |
+
foreach ( $fields as $key => $field ) {
|
191 |
+
|
192 |
+
// rename programs field ##
|
193 |
+
if ( $field == 'member_of_club' ){
|
194 |
+
$field = 'Program';
|
195 |
+
}
|
196 |
+
|
197 |
+
if ( in_array( $field, $exclude_data ) )
|
198 |
+
unset( $fields[$key] );
|
199 |
+
else
|
200 |
+
$headers[] = '"' . $field . '"';
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
// echo headers ##
|
205 |
+
echo implode( $seperator, $headers ) . $breaker;
|
206 |
+
|
207 |
+
// build row values for each user ##
|
208 |
+
foreach ( $users as $user ) {
|
209 |
+
|
210 |
+
$data = array();
|
211 |
+
foreach ( $fields as $field ) {
|
212 |
+
|
213 |
+
// BP loaded ? ##
|
214 |
+
if ( function_exists ('bp_is_active') ) {
|
215 |
+
$bp_data = BP_XProfile_ProfileData::get_all_for_user($user->ID);
|
216 |
+
}
|
217 |
+
|
218 |
+
// check if this is a BP field ##
|
219 |
+
if ( in_array( $field, $bp_fields_passed ) ) {
|
220 |
+
|
221 |
+
$value = $bp_data[$field];
|
222 |
+
|
223 |
+
if (is_array($value)) {
|
224 |
+
$value = $value['field_data'];
|
225 |
+
}
|
226 |
+
$value = $this->sanitize($value);
|
227 |
+
|
228 |
+
// user data or usermeta ##
|
229 |
+
} else {
|
230 |
+
|
231 |
+
$value = isset( $user->{$field} ) ? $user->{$field} : '';
|
232 |
+
$value = is_array( $value ) ? serialize( $value ) : $value;
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
// correct program value to Program Name ##
|
237 |
+
if ( $field == 'member_of_club' ){
|
238 |
+
$value = get_the_title($value);
|
239 |
+
}
|
240 |
+
|
241 |
+
$data[] = '"' . str_replace( '"', '""', $value ) . '"';
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
// echo row data ##
|
246 |
+
echo implode( $seperator, $data ) . $breaker;
|
247 |
+
}
|
248 |
+
|
249 |
+
// stop PHP, so file can export correctly ##
|
250 |
+
exit;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Content of the settings page
|
256 |
+
*
|
257 |
+
* @since 0.1
|
258 |
+
**/
|
259 |
+
public function users_page() {
|
260 |
+
if ( ! current_user_can( 'list_users' ) ) {
|
261 |
+
wp_die( __( 'You do not have sufficient permissions to access this page.', 'export-user-data' ) );
|
262 |
+
}
|
263 |
+
?>
|
264 |
+
|
265 |
+
<div class="wrap">
|
266 |
+
<h2><?php _e( 'Export User Data', 'export-user-data' ); ?></h2>
|
267 |
+
<?php
|
268 |
+
|
269 |
+
// nothing happening? ##
|
270 |
+
if ( isset( $_GET['error'] ) ) {
|
271 |
+
echo '<div class="updated"><p><strong>' . __( 'No users found.', 'export-user-data' ) . '</strong></p></div>';
|
272 |
+
}
|
273 |
+
|
274 |
+
?>
|
275 |
+
<form method="post" action="" enctype="multipart/form-data">
|
276 |
+
<?php wp_nonce_field( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' ); ?>
|
277 |
+
<table class="form-table">
|
278 |
+
<?php
|
279 |
+
|
280 |
+
// allow admin to select user meta fields to export ##
|
281 |
+
global $wpdb;
|
282 |
+
$meta_keys = $wpdb->get_results( "SELECT distinct(meta_key) FROM $wpdb->usermeta" );
|
283 |
+
|
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_',
|
292 |
+
'nav_',
|
293 |
+
'wp_',
|
294 |
+
'admin_color',
|
295 |
+
'wpmudev',
|
296 |
+
'screen_',
|
297 |
+
'show_',
|
298 |
+
'rich_',
|
299 |
+
'reward_',
|
300 |
+
'meta-box',
|
301 |
+
'manageedit',
|
302 |
+
'edit_',
|
303 |
+
'closedpostboxes_',
|
304 |
+
'dismissed_',
|
305 |
+
'manage',
|
306 |
+
'comment',
|
307 |
+
'current',
|
308 |
+
'incentive_',
|
309 |
+
'_wdp',
|
310 |
+
'ssl',
|
311 |
+
'wdfb',
|
312 |
+
'users_per_page',
|
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 |
+
|
324 |
+
#echo 'FOUND -- '.$drop.' in '.$key.'<br />';
|
325 |
+
|
326 |
+
if(($key = array_search($key, $meta_keys)) !== false) {
|
327 |
+
unset($meta_keys[$key]);
|
328 |
+
}
|
329 |
+
|
330 |
+
}
|
331 |
+
|
332 |
+
}
|
333 |
+
|
334 |
+
}
|
335 |
+
|
336 |
+
// test array ##
|
337 |
+
#echo '<pre>'; var_dump($meta_keys); echo '</pre>';
|
338 |
+
|
339 |
+
// check if we got anything ? ##
|
340 |
+
if ( $meta_keys ) {
|
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
|
369 |
+
|
370 |
+
} // meta_keys found ##
|
371 |
+
|
372 |
+
?>
|
373 |
+
<?php
|
374 |
+
|
375 |
+
// buddypress x profile data ##
|
376 |
+
if ( function_exists ('bp_is_active') ) {
|
377 |
+
|
378 |
+
// grab all buddypress x profile fields ##
|
379 |
+
$bp_fields = $wpdb->get_results( "SELECT distinct(name) FROM ".$wpdb->base_prefix."bp_xprofile_fields WHERE parent_id = 0" );
|
380 |
+
|
381 |
+
// get name value from object ##
|
382 |
+
$bp_fields = wp_list_pluck( $bp_fields, 'name' );
|
383 |
+
|
384 |
+
// test array ##
|
385 |
+
#echo '<pre>'; var_dump($bp_fields); echo '</pre>';
|
386 |
+
|
387 |
+
// allow array to be filtered ##
|
388 |
+
$bp_fields = apply_filters( 'export_user_data_bp_fields', $bp_fields );
|
389 |
+
|
390 |
+
?>
|
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 ) {
|
397 |
+
|
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
|
407 |
+
|
408 |
+
} // BP installed and active ##
|
409 |
+
|
410 |
+
?>
|
411 |
+
<tr valign="top">
|
412 |
+
<th scope="row"><label for="q_eud_users_role"><?php _e( 'Role', 'export-user-data' ); ?></label></th>
|
413 |
+
<td>
|
414 |
+
<select name="role" id="q_eud_users_role">
|
415 |
+
<?php
|
416 |
+
|
417 |
+
echo '<option value="">' . __( 'All Roles', 'export-user-data' ) . '</option>';
|
418 |
+
global $wp_roles;
|
419 |
+
foreach ( $wp_roles->role_names as $role => $name ) {
|
420 |
+
echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
421 |
+
}
|
422 |
+
|
423 |
+
?>
|
424 |
+
</select>
|
425 |
+
</td>
|
426 |
+
</tr>
|
427 |
+
<?php
|
428 |
+
|
429 |
+
// clubs ? ##
|
430 |
+
if ( post_type_exists( 'club' ) ) {
|
431 |
+
|
432 |
+
?>
|
433 |
+
<tr valign="top">
|
434 |
+
<th scope="row"><label for="q_eud_users_program"><?php _e( 'Programs', 'export-user-data' ); ?></label></th>
|
435 |
+
<td>
|
436 |
+
<select name="program" id="q_eud_users_program">
|
437 |
+
<?php
|
438 |
+
|
439 |
+
echo '<option value="">' . __( 'All Programs', 'export-user-data' ) . '</option>';
|
440 |
+
|
441 |
+
$clubs_array = get_posts(array( 'post_type'=> 'club', 'posts_per_page' => -1 )); // grab all posts of type "club" ##
|
442 |
+
|
443 |
+
foreach ( $clubs_array as $c ) { // loop over all clubs ##
|
444 |
+
|
445 |
+
#$clubs[$c->ID] = $c; // grab club ID ##
|
446 |
+
echo "\n\t<option value='" . esc_attr( $c->ID ) . "'>$c->post_title</option>";
|
447 |
+
|
448 |
+
}
|
449 |
+
|
450 |
+
?>
|
451 |
+
</select>
|
452 |
+
</td>
|
453 |
+
</tr>
|
454 |
+
<?php
|
455 |
+
|
456 |
+
} // clubs ##
|
457 |
+
|
458 |
+
?>
|
459 |
+
<tr valign="top">
|
460 |
+
<th scope="row"><label><?php _e( 'Registred', 'export-user-data' ); ?></label></th>
|
461 |
+
<td>
|
462 |
+
<select name="start_date" id="q_eud_users_start_date">
|
463 |
+
<option value="0"><?php _e( 'Start Date', 'export-user-data' ); ?></option>
|
464 |
+
<?php $this->export_date_options(); ?>
|
465 |
+
</select>
|
466 |
+
<select name="end_date" id="q_eud_users_end_date">
|
467 |
+
<option value="0"><?php _e( 'End Date', 'export-user-data' ); ?></option>
|
468 |
+
<?php $this->export_date_options(); ?>
|
469 |
+
</select>
|
470 |
+
</td>
|
471 |
+
</tr>
|
472 |
+
|
473 |
+
<tr valign="top">
|
474 |
+
<th scope="row"><label for="q_eud_users_format"><?php _e( 'Format', 'export-user-data' ); ?></label></th>
|
475 |
+
<td>
|
476 |
+
<select name="format" id="q_eud_users_format">
|
477 |
+
<?php
|
478 |
+
|
479 |
+
echo '<option value="excel">' . __( 'Excel', 'export-user-data' ) . '</option>';
|
480 |
+
echo '<option value="csv">' . __( 'CSV', 'export-user-data' ) . '</option>';
|
481 |
+
|
482 |
+
?>
|
483 |
+
</select>
|
484 |
+
</td>
|
485 |
+
</tr>
|
486 |
+
</table>
|
487 |
+
<p class="submit">
|
488 |
+
<input type="hidden" name="_wp_http_referer" value="<?php echo $_SERVER['REQUEST_URI'] ?>" />
|
489 |
+
<input type="submit" class="button-primary" value="<?php _e( 'Export', 'export-user-data' ); ?>" />
|
490 |
+
</p>
|
491 |
+
</form>
|
492 |
+
<?php
|
493 |
+
}
|
494 |
+
|
495 |
+
// data to exclude from export ##
|
496 |
+
public function exclude_data() {
|
497 |
+
$exclude = array( 'user_pass', 'user_activation_key' );
|
498 |
+
return $exclude;
|
499 |
+
}
|
500 |
+
|
501 |
+
public function pre_user_query( $user_search ) {
|
502 |
+
global $wpdb;
|
503 |
+
|
504 |
+
$where = '';
|
505 |
+
|
506 |
+
if ( ! empty( $_POST['start_date'] ) )
|
507 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered >= %s", date( 'Y-m-d', strtotime( $_POST['start_date'] ) ) );
|
508 |
+
|
509 |
+
if ( ! empty( $_POST['end_date'] ) )
|
510 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $_POST['end_date'] ) ) ) );
|
511 |
+
|
512 |
+
if ( ! empty( $where ) )
|
513 |
+
$user_search->query_where = str_replace( 'WHERE 1=1', "WHERE 1=1 $where", $user_search->query_where );
|
514 |
+
|
515 |
+
return $user_search;
|
516 |
+
}
|
517 |
+
|
518 |
+
private function export_date_options() {
|
519 |
+
global $wpdb, $wp_locale;
|
520 |
+
|
521 |
+
$months = $wpdb->get_results( "
|
522 |
+
SELECT DISTINCT YEAR( user_registered ) AS year, MONTH( user_registered ) AS month
|
523 |
+
FROM $wpdb->users
|
524 |
+
ORDER BY user_registered DESC
|
525 |
+
" );
|
526 |
+
|
527 |
+
$month_count = count( $months );
|
528 |
+
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
|
529 |
+
return;
|
530 |
+
|
531 |
+
foreach ( $months as $date ) {
|
532 |
+
if ( 0 == $date->year )
|
533 |
+
continue;
|
534 |
+
|
535 |
+
$month = zeroise( $date->month, 2 );
|
536 |
+
echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';
|
537 |
+
}
|
538 |
+
}
|
539 |
+
}
|
540 |
+
|
541 |
+
new Q_EUD_Export_Users;
|
tags/0.6.1/languages/default.mo
ADDED
Binary file
|
tags/0.6.1/languages/default.po
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.5.4\n"
|
14 |
+
"X-Poedit-KeywordsList: _;_e;_n;__\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
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 ""
|
tags/0.6.1/readme.txt
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
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
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
A plugin that exports ALL user data, meta data and BuddyPress xProfile data.
|
14 |
+
|
15 |
+
Includes an option to export the users by role, registration date range, usermeta option and two export formats.
|
16 |
+
|
17 |
+
Based on: http://wordpress.org/plugins/export-users-to-csv/
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* Exports all users fields
|
22 |
+
* Exports users meta
|
23 |
+
* Exports users by role
|
24 |
+
* Exports users by date range
|
25 |
+
* Export user BuddyPress xProfile data
|
26 |
+
|
27 |
+
For feature request and bug reports, [please use the forums](http://wordpress.org/tags/export-users-data).
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
For an automatic installation through WordPress:
|
32 |
+
|
33 |
+
1. Go to the 'Add New' plugins screen in your WordPress admin area
|
34 |
+
1. Search for 'Export User Data'
|
35 |
+
1. Click 'Install Now' and activate the plugin
|
36 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
37 |
+
|
38 |
+
|
39 |
+
For a manual installation via FTP:
|
40 |
+
|
41 |
+
1. Upload the `export-user-data` directory to the `/wp-content/plugins/` directory
|
42 |
+
1. Activate the plugin through the 'Plugins' screen in your WordPress admin area
|
43 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
44 |
+
|
45 |
+
|
46 |
+
To upload the plugin through WordPress, instead of FTP:
|
47 |
+
|
48 |
+
1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
|
49 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
50 |
+
|
51 |
+
== Frequently Asked Questions ==
|
52 |
+
|
53 |
+
= How to use? =
|
54 |
+
|
55 |
+
Click on the 'Export User Data' link in the 'Users' menu, choose the role and the date range or don't select anything if you want to export all users, then click 'Export'. That's all!
|
56 |
+
|
57 |
+
== Screenshots ==
|
58 |
+
|
59 |
+
1. User export screen
|
60 |
+
|
61 |
+
== Changelog ==
|
62 |
+
|
63 |
+
= 0.5 =
|
64 |
+
* First public release.
|
65 |
+
|
66 |
+
== Upgrade Notice ==
|
67 |
+
|
68 |
+
= 0.5 =
|
69 |
+
First release.
|
tags/0.6.1/screenshot-1.png
ADDED
Binary file
|
{css → tags/0.6.3/css}/multi-select.css
RENAMED
File without changes
|
export-user-data.php → tags/0.6.3/export-user-data.php
RENAMED
File without changes
|
{img → tags/0.6.3/img}/switch.png
RENAMED
File without changes
|
{js → tags/0.6.3/js}/jquery.multi-select.js
RENAMED
File without changes
|
{languages → tags/0.6.3/languages}/default.mo
RENAMED
File without changes
|
{languages → tags/0.6.3/languages}/default.po
RENAMED
File without changes
|
readme.txt → tags/0.6.3/readme.txt
RENAMED
File without changes
|
tags/0.6.3/screenshot-1.png
ADDED
Binary file
|
tags/0.6/export-user-data.php
ADDED
@@ -0,0 +1,538 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Export_User_Data
|
4 |
+
* @version 0.5.2
|
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.5.2
|
11 |
+
Author: Q Studio
|
12 |
+
Author URI: http://qstudio.us/
|
13 |
+
License: GPL2
|
14 |
+
Text Domain: export-user-data
|
15 |
+
Based on: Export User to CSV by PubPoet ( http://pubpoet.com/ )- Thanks!
|
16 |
+
*/
|
17 |
+
|
18 |
+
load_plugin_textdomain( 'export-user-data', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Main plugin class
|
22 |
+
*
|
23 |
+
* @since 0.1
|
24 |
+
**/
|
25 |
+
class Q_EUD_Export_Users {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class contructor
|
29 |
+
*
|
30 |
+
* @since 0.1
|
31 |
+
**/
|
32 |
+
public function __construct() {
|
33 |
+
add_action( 'admin_menu', array( $this, 'add_admin_pages' ) );
|
34 |
+
add_action( 'init', array( $this, 'generate_data' ) );
|
35 |
+
add_filter( 'q_eud_exclude_data', array( $this, 'exclude_data' ) );
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Add administration menus
|
40 |
+
*
|
41 |
+
* @since 0.1
|
42 |
+
**/
|
43 |
+
public function add_admin_pages() {
|
44 |
+
add_users_page( __( 'Export User Data', 'export-user-data' ), __( 'Export User Data', 'export-user-data' ), 'list_users', 'export-user-data', array( $this, 'users_page' ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
/* clean that stuff up ## */
|
48 |
+
public function sanitize($value) {
|
49 |
+
$value = str_replace("\r", '', $value);
|
50 |
+
$value = str_replace("\n", '', $value);
|
51 |
+
$value = str_replace("\t", '', $value);
|
52 |
+
return $value;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Process content of CSV file
|
57 |
+
*
|
58 |
+
* @since 0.1
|
59 |
+
**/
|
60 |
+
public function generate_data() {
|
61 |
+
if ( isset( $_POST['_wpnonce-q-eud-export-user-page_export'] ) ) {
|
62 |
+
check_admin_referer( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' );
|
63 |
+
|
64 |
+
// build argument array ##
|
65 |
+
$args = array(
|
66 |
+
'fields' => 'all_with_meta',
|
67 |
+
'role' => stripslashes( $_POST['role'] )
|
68 |
+
);
|
69 |
+
|
70 |
+
// did the user request a specific program ? ##
|
71 |
+
if ( isset( $_POST['program'] ) && $_POST['program'] != '' ) {
|
72 |
+
|
73 |
+
$args['meta_key'] = 'member_of_club';
|
74 |
+
$args['meta_value'] = (int)$_POST['program'];
|
75 |
+
$args['meta_compare'] = '=';
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
add_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
80 |
+
$users = get_users( $args );
|
81 |
+
remove_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
82 |
+
|
83 |
+
if ( ! $users ) {
|
84 |
+
$referer = add_query_arg( 'error', 'empty', wp_get_referer() );
|
85 |
+
wp_redirect( $referer );
|
86 |
+
exit;
|
87 |
+
}
|
88 |
+
|
89 |
+
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
90 |
+
if ( ! empty( $sitename ) )
|
91 |
+
$sitename .= '.';
|
92 |
+
|
93 |
+
// export method ? ##
|
94 |
+
$export_method = 'excel'; // default to Excel export ##
|
95 |
+
if ( isset( $_POST['format'] ) && $_POST['format'] != '' ) {
|
96 |
+
|
97 |
+
$export_method = $_POST['format'];
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
// set export filename structure ##
|
102 |
+
$filename = $sitename . 'users.' . date( 'Y-m-d-H-i-s' );
|
103 |
+
|
104 |
+
switch ( $export_method ) {
|
105 |
+
|
106 |
+
case "csv":
|
107 |
+
|
108 |
+
// to csv ##
|
109 |
+
header( 'Content-Description: File Transfer' );
|
110 |
+
header( 'Content-Disposition: attachment; filename='.$filename.'.csv' );
|
111 |
+
header( 'Content-Type: text/csv; charset=' . get_option( 'blog_charset' ), true );
|
112 |
+
|
113 |
+
// how to seperate data ##
|
114 |
+
$seperator = ','; // comma for csv ##
|
115 |
+
|
116 |
+
break;
|
117 |
+
|
118 |
+
case ('excel'):
|
119 |
+
|
120 |
+
// to xls ##
|
121 |
+
header( 'Content-Description: File Transfer' );
|
122 |
+
header("Content-Type: application/vnd.ms-excel");
|
123 |
+
header("Content-Disposition: attachment; filename=$filename.xls");
|
124 |
+
header("Pragma: no-cache");
|
125 |
+
header("Expires: 0");
|
126 |
+
|
127 |
+
// how to seperate data ##
|
128 |
+
$seperator = "\t"; //tabbed character
|
129 |
+
|
130 |
+
break;
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
// line break ##
|
135 |
+
$breaker = "\n";
|
136 |
+
|
137 |
+
// function to exclude data ##
|
138 |
+
$exclude_data = apply_filters( 'q_eud_exclude_data', array() );
|
139 |
+
|
140 |
+
// check for selected usermeta fields ##
|
141 |
+
$usermeta = $_POST['usermeta'];
|
142 |
+
$usermeta_fields = array();
|
143 |
+
foreach( $usermeta as $field ) {
|
144 |
+
$usermeta_fields[] = $field;
|
145 |
+
}
|
146 |
+
|
147 |
+
// array of usermeta fields to include ##
|
148 |
+
/*
|
149 |
+
$usermeta_fields = array(
|
150 |
+
'member_of_club', // program ID ##
|
151 |
+
'last_activity', // last BP activity ##
|
152 |
+
'q_api_u_key', // Adage registration key ##
|
153 |
+
'rewards_milestone', // if reward milestone reached ##
|
154 |
+
'total_friend_count', // BP friend count ##
|
155 |
+
);
|
156 |
+
*/
|
157 |
+
|
158 |
+
// check for selected x profile fields ##
|
159 |
+
$bp_fields = $_POST['bp_fields'];
|
160 |
+
$bp_fields_passed = array();
|
161 |
+
foreach( $bp_fields as $field ) {
|
162 |
+
|
163 |
+
// reverse tidy ##
|
164 |
+
$field = str_replace( '__', ' ', $field );
|
165 |
+
|
166 |
+
// add to array ##
|
167 |
+
$bp_fields_passed[] = $field;
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
// global wpdb object ##
|
172 |
+
global $wpdb;
|
173 |
+
|
174 |
+
// requested user data ##
|
175 |
+
$data_keys = array(
|
176 |
+
'ID', 'user_login', 'user_pass',
|
177 |
+
'user_nicename', 'user_email', 'user_url',
|
178 |
+
'user_registered', /*'user_activation_key',*/ /*'user_status',*/
|
179 |
+
'display_name'
|
180 |
+
);
|
181 |
+
|
182 |
+
// compile final fields list ##
|
183 |
+
$fields = array_merge( $data_keys, $usermeta_fields, $bp_fields_passed );
|
184 |
+
|
185 |
+
// build the document headers ##
|
186 |
+
$headers = array();
|
187 |
+
foreach ( $fields as $key => $field ) {
|
188 |
+
|
189 |
+
// rename programs field ##
|
190 |
+
if ( $field == 'member_of_club' ){
|
191 |
+
$field = 'Program';
|
192 |
+
}
|
193 |
+
|
194 |
+
if ( in_array( $field, $exclude_data ) )
|
195 |
+
unset( $fields[$key] );
|
196 |
+
else
|
197 |
+
$headers[] = '"' . $field . '"';
|
198 |
+
|
199 |
+
}
|
200 |
+
|
201 |
+
// echo headers ##
|
202 |
+
echo implode( $seperator, $headers ) . $breaker;
|
203 |
+
|
204 |
+
// build row values for each user ##
|
205 |
+
foreach ( $users as $user ) {
|
206 |
+
|
207 |
+
$data = array();
|
208 |
+
foreach ( $fields as $field ) {
|
209 |
+
|
210 |
+
// BP loaded ? ##
|
211 |
+
if ( function_exists ('bp_is_active') ) {
|
212 |
+
$bp_data = BP_XProfile_ProfileData::get_all_for_user($user->ID);
|
213 |
+
}
|
214 |
+
|
215 |
+
// check if this is a BP field ##
|
216 |
+
if ( in_array( $field, $bp_fields_passed ) ) {
|
217 |
+
|
218 |
+
$value = $bp_data[$field];
|
219 |
+
|
220 |
+
if (is_array($value)) {
|
221 |
+
$value = $value['field_data'];
|
222 |
+
}
|
223 |
+
$value = $this->sanitize($value);
|
224 |
+
|
225 |
+
// user data or usermeta ##
|
226 |
+
} else {
|
227 |
+
|
228 |
+
$value = isset( $user->{$field} ) ? $user->{$field} : '';
|
229 |
+
$value = is_array( $value ) ? serialize( $value ) : $value;
|
230 |
+
|
231 |
+
}
|
232 |
+
|
233 |
+
// correct program value to Program Name ##
|
234 |
+
if ( $field == 'member_of_club' ){
|
235 |
+
$value = get_the_title($value);
|
236 |
+
}
|
237 |
+
|
238 |
+
$data[] = '"' . str_replace( '"', '""', $value ) . '"';
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
// echo row data ##
|
243 |
+
echo implode( $seperator, $data ) . $breaker;
|
244 |
+
}
|
245 |
+
|
246 |
+
// stop PHP, so file can export correctly ##
|
247 |
+
exit;
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Content of the settings page
|
253 |
+
*
|
254 |
+
* @since 0.1
|
255 |
+
**/
|
256 |
+
public function users_page() {
|
257 |
+
if ( ! current_user_can( 'list_users' ) ) {
|
258 |
+
wp_die( __( 'You do not have sufficient permissions to access this page.', 'export-user-data' ) );
|
259 |
+
}
|
260 |
+
?>
|
261 |
+
|
262 |
+
<div class="wrap">
|
263 |
+
<h2><?php _e( 'Export User Data', 'export-user-data' ); ?></h2>
|
264 |
+
<?php
|
265 |
+
|
266 |
+
// nothing happening? ##
|
267 |
+
if ( isset( $_GET['error'] ) ) {
|
268 |
+
echo '<div class="updated"><p><strong>' . __( 'No users found.', 'export-user-data' ) . '</strong></p></div>';
|
269 |
+
}
|
270 |
+
|
271 |
+
?>
|
272 |
+
<form method="post" action="" enctype="multipart/form-data">
|
273 |
+
<?php wp_nonce_field( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' ); ?>
|
274 |
+
<table class="form-table">
|
275 |
+
<?php
|
276 |
+
|
277 |
+
// allow admin to select user meta fields to export ##
|
278 |
+
global $wpdb;
|
279 |
+
$meta_keys = $wpdb->get_results( "SELECT distinct(meta_key) FROM $wpdb->usermeta" );
|
280 |
+
|
281 |
+
// get meta_key value from object ##
|
282 |
+
$meta_keys = wp_list_pluck( $meta_keys, 'meta_key' );
|
283 |
+
|
284 |
+
// let's ditch some of them odd keys ##
|
285 |
+
$meta_keys_drop = array(
|
286 |
+
'metaboxhidden',
|
287 |
+
'activation',
|
288 |
+
'bp_',
|
289 |
+
'nav_',
|
290 |
+
'wp_',
|
291 |
+
'admin_color',
|
292 |
+
'wpmudev',
|
293 |
+
'screen_',
|
294 |
+
'show_',
|
295 |
+
'rich_',
|
296 |
+
'reward_',
|
297 |
+
'meta-box',
|
298 |
+
'manageedit',
|
299 |
+
'edit_',
|
300 |
+
'closedpostboxes_',
|
301 |
+
'dismissed_',
|
302 |
+
'manage',
|
303 |
+
'comment',
|
304 |
+
'current',
|
305 |
+
'incentive_',
|
306 |
+
'_wdp',
|
307 |
+
'ssl',
|
308 |
+
'wdfb',
|
309 |
+
'users_per_page',
|
310 |
+
);
|
311 |
+
|
312 |
+
// allow array to be filtered ##
|
313 |
+
$meta_keys_drop = apply_filters( 'export_user_data_meta_keys_drop', $meta_keys_drop );
|
314 |
+
|
315 |
+
foreach ( $meta_keys as $key ) {
|
316 |
+
|
317 |
+
foreach ( $meta_keys_drop as $drop ) {
|
318 |
+
|
319 |
+
if ( strpos( $key, $drop ) !== false ) {
|
320 |
+
|
321 |
+
#echo 'FOUND -- '.$drop.' in '.$key.'<br />';
|
322 |
+
|
323 |
+
if(($key = array_search($key, $meta_keys)) !== false) {
|
324 |
+
unset($meta_keys[$key]);
|
325 |
+
}
|
326 |
+
|
327 |
+
}
|
328 |
+
|
329 |
+
}
|
330 |
+
|
331 |
+
}
|
332 |
+
|
333 |
+
// test array ##
|
334 |
+
#echo '<pre>'; var_dump($meta_keys); echo '</pre>';
|
335 |
+
|
336 |
+
// check if we got anything ? ##
|
337 |
+
if ( $meta_keys ) {
|
338 |
+
|
339 |
+
?>
|
340 |
+
<tr valign="top">
|
341 |
+
<th scope="row"><label for="q_eud_usermeta"><?php _e( 'User Meta Fields', 'export-user-data' ); ?></label></th>
|
342 |
+
<td>
|
343 |
+
<?php
|
344 |
+
|
345 |
+
foreach ( $meta_keys as $key ) {
|
346 |
+
|
347 |
+
#echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
348 |
+
|
349 |
+
// display $key ##
|
350 |
+
$display_key = $key;
|
351 |
+
|
352 |
+
// rename programs field ##
|
353 |
+
if ( $display_key == 'member_of_club' ){
|
354 |
+
$display_key = 'program';
|
355 |
+
}
|
356 |
+
|
357 |
+
// tidy ##
|
358 |
+
$display_key = str_replace( "_", " ", ucwords($display_key) );
|
359 |
+
|
360 |
+
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 />";
|
361 |
+
}
|
362 |
+
?>
|
363 |
+
</td>
|
364 |
+
</tr>
|
365 |
+
<?php
|
366 |
+
|
367 |
+
} // meta_keys found ##
|
368 |
+
|
369 |
+
?>
|
370 |
+
<?php
|
371 |
+
|
372 |
+
// buddypress x profile data ##
|
373 |
+
if ( function_exists ('bp_is_active') ) {
|
374 |
+
|
375 |
+
// grab all buddypress x profile fields ##
|
376 |
+
$bp_fields = $wpdb->get_results( "SELECT distinct(name) FROM ".$wpdb->base_prefix."bp_xprofile_fields WHERE parent_id = 0" );
|
377 |
+
|
378 |
+
// get name value from object ##
|
379 |
+
$bp_fields = wp_list_pluck( $bp_fields, 'name' );
|
380 |
+
|
381 |
+
// test array ##
|
382 |
+
#echo '<pre>'; var_dump($bp_fields); echo '</pre>';
|
383 |
+
|
384 |
+
// allow array to be filtered ##
|
385 |
+
$bp_fields = apply_filters( 'export_user_data_bp_fields', $bp_fields );
|
386 |
+
|
387 |
+
?>
|
388 |
+
<tr valign="top">
|
389 |
+
<th scope="row"><label for="q_eud_xprofile"><?php _e( 'BP xProfile Fields', 'export-user-data' ); ?></label></th>
|
390 |
+
<td>
|
391 |
+
<?php
|
392 |
+
|
393 |
+
foreach ( $bp_fields as $key ) {
|
394 |
+
|
395 |
+
// tidy up key ##
|
396 |
+
$key_tidy = str_replace( ' ', '__', ($key));
|
397 |
+
|
398 |
+
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 />";
|
399 |
+
}
|
400 |
+
?>
|
401 |
+
</td>
|
402 |
+
</tr>
|
403 |
+
<?php
|
404 |
+
|
405 |
+
} // BP installed and active ##
|
406 |
+
|
407 |
+
?>
|
408 |
+
<tr valign="top">
|
409 |
+
<th scope="row"><label for="q_eud_users_role"><?php _e( 'Role', 'export-user-data' ); ?></label></th>
|
410 |
+
<td>
|
411 |
+
<select name="role" id="q_eud_users_role">
|
412 |
+
<?php
|
413 |
+
|
414 |
+
echo '<option value="">' . __( 'All Roles', 'export-user-data' ) . '</option>';
|
415 |
+
global $wp_roles;
|
416 |
+
foreach ( $wp_roles->role_names as $role => $name ) {
|
417 |
+
echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
418 |
+
}
|
419 |
+
|
420 |
+
?>
|
421 |
+
</select>
|
422 |
+
</td>
|
423 |
+
</tr>
|
424 |
+
<?php
|
425 |
+
|
426 |
+
// clubs ? ##
|
427 |
+
if ( post_type_exists( 'club' ) ) {
|
428 |
+
|
429 |
+
?>
|
430 |
+
<tr valign="top">
|
431 |
+
<th scope="row"><label for="q_eud_users_program"><?php _e( 'Programs', 'export-user-data' ); ?></label></th>
|
432 |
+
<td>
|
433 |
+
<select name="program" id="q_eud_users_program">
|
434 |
+
<?php
|
435 |
+
|
436 |
+
echo '<option value="">' . __( 'All Programs', 'export-user-data' ) . '</option>';
|
437 |
+
|
438 |
+
$clubs_array = get_posts(array( 'post_type'=> 'club', 'posts_per_page' => -1 )); // grab all posts of type "club" ##
|
439 |
+
|
440 |
+
foreach ( $clubs_array as $c ) { // loop over all clubs ##
|
441 |
+
|
442 |
+
#$clubs[$c->ID] = $c; // grab club ID ##
|
443 |
+
echo "\n\t<option value='" . esc_attr( $c->ID ) . "'>$c->post_title</option>";
|
444 |
+
|
445 |
+
}
|
446 |
+
|
447 |
+
?>
|
448 |
+
</select>
|
449 |
+
</td>
|
450 |
+
</tr>
|
451 |
+
<?php
|
452 |
+
|
453 |
+
} // clubs ##
|
454 |
+
|
455 |
+
?>
|
456 |
+
<tr valign="top">
|
457 |
+
<th scope="row"><label><?php _e( 'Registred', 'export-user-data' ); ?></label></th>
|
458 |
+
<td>
|
459 |
+
<select name="start_date" id="q_eud_users_start_date">
|
460 |
+
<option value="0"><?php _e( 'Start Date', 'export-user-data' ); ?></option>
|
461 |
+
<?php $this->export_date_options(); ?>
|
462 |
+
</select>
|
463 |
+
<select name="end_date" id="q_eud_users_end_date">
|
464 |
+
<option value="0"><?php _e( 'End Date', 'export-user-data' ); ?></option>
|
465 |
+
<?php $this->export_date_options(); ?>
|
466 |
+
</select>
|
467 |
+
</td>
|
468 |
+
</tr>
|
469 |
+
|
470 |
+
<tr valign="top">
|
471 |
+
<th scope="row"><label for="q_eud_users_format"><?php _e( 'Format', 'export-user-data' ); ?></label></th>
|
472 |
+
<td>
|
473 |
+
<select name="format" id="q_eud_users_format">
|
474 |
+
<?php
|
475 |
+
|
476 |
+
echo '<option value="excel">' . __( 'Excel', 'export-user-data' ) . '</option>';
|
477 |
+
echo '<option value="csv">' . __( 'CSV', 'export-user-data' ) . '</option>';
|
478 |
+
|
479 |
+
?>
|
480 |
+
</select>
|
481 |
+
</td>
|
482 |
+
</tr>
|
483 |
+
</table>
|
484 |
+
<p class="submit">
|
485 |
+
<input type="hidden" name="_wp_http_referer" value="<?php echo $_SERVER['REQUEST_URI'] ?>" />
|
486 |
+
<input type="submit" class="button-primary" value="<?php _e( 'Export', 'export-user-data' ); ?>" />
|
487 |
+
</p>
|
488 |
+
</form>
|
489 |
+
<?php
|
490 |
+
}
|
491 |
+
|
492 |
+
// data to exclude from export ##
|
493 |
+
public function exclude_data() {
|
494 |
+
$exclude = array( 'user_pass', 'user_activation_key' );
|
495 |
+
return $exclude;
|
496 |
+
}
|
497 |
+
|
498 |
+
public function pre_user_query( $user_search ) {
|
499 |
+
global $wpdb;
|
500 |
+
|
501 |
+
$where = '';
|
502 |
+
|
503 |
+
if ( ! empty( $_POST['start_date'] ) )
|
504 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered >= %s", date( 'Y-m-d', strtotime( $_POST['start_date'] ) ) );
|
505 |
+
|
506 |
+
if ( ! empty( $_POST['end_date'] ) )
|
507 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $_POST['end_date'] ) ) ) );
|
508 |
+
|
509 |
+
if ( ! empty( $where ) )
|
510 |
+
$user_search->query_where = str_replace( 'WHERE 1=1', "WHERE 1=1 $where", $user_search->query_where );
|
511 |
+
|
512 |
+
return $user_search;
|
513 |
+
}
|
514 |
+
|
515 |
+
private function export_date_options() {
|
516 |
+
global $wpdb, $wp_locale;
|
517 |
+
|
518 |
+
$months = $wpdb->get_results( "
|
519 |
+
SELECT DISTINCT YEAR( user_registered ) AS year, MONTH( user_registered ) AS month
|
520 |
+
FROM $wpdb->users
|
521 |
+
ORDER BY user_registered DESC
|
522 |
+
" );
|
523 |
+
|
524 |
+
$month_count = count( $months );
|
525 |
+
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
|
526 |
+
return;
|
527 |
+
|
528 |
+
foreach ( $months as $date ) {
|
529 |
+
if ( 0 == $date->year )
|
530 |
+
continue;
|
531 |
+
|
532 |
+
$month = zeroise( $date->month, 2 );
|
533 |
+
echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';
|
534 |
+
}
|
535 |
+
}
|
536 |
+
}
|
537 |
+
|
538 |
+
new Q_EUD_Export_Users;
|
tags/0.6/languages/default.mo
ADDED
Binary file
|
tags/0.6/languages/default.po
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.5.4\n"
|
14 |
+
"X-Poedit-KeywordsList: _;_e;_n;__\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
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 ""
|
tags/0.6/readme.txt
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
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.5.2
|
7 |
+
License: GPLv2
|
8 |
+
Original: http://wordpress.org/plugins/export-users-to-csv/
|
9 |
+
|
10 |
+
Export users data, metadata and buddypress xprofile data to a csv or Excel file
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
A plugin that exports ALL user data, meta data and BuddyPress xProfile data.
|
15 |
+
|
16 |
+
Includes an option to export the users by role, registration date range, usermeta option and two export formats.
|
17 |
+
|
18 |
+
= Features =
|
19 |
+
|
20 |
+
* Exports all users fields
|
21 |
+
* Exports users meta
|
22 |
+
* Exports users by role
|
23 |
+
* Exports users by date range
|
24 |
+
* Export user BuddyPress xProfile data
|
25 |
+
|
26 |
+
For feature request and bug reports, [please use the forums](http://wordpress.org/tags/export-users-data).
|
27 |
+
|
28 |
+
== Installation ==
|
29 |
+
|
30 |
+
For an automatic installation through WordPress:
|
31 |
+
|
32 |
+
1. Go to the 'Add New' plugins screen in your WordPress admin area
|
33 |
+
1. Search for 'Export User Data'
|
34 |
+
1. Click 'Install Now' and activate the plugin
|
35 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
36 |
+
|
37 |
+
|
38 |
+
For a manual installation via FTP:
|
39 |
+
|
40 |
+
1. Upload the `export-user-data` directory to the `/wp-content/plugins/` directory
|
41 |
+
1. Activate the plugin through the 'Plugins' screen in your WordPress admin area
|
42 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
43 |
+
|
44 |
+
|
45 |
+
To upload the plugin through WordPress, instead of FTP:
|
46 |
+
|
47 |
+
1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
|
48 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
49 |
+
|
50 |
+
== Frequently Asked Questions ==
|
51 |
+
|
52 |
+
= How to use? =
|
53 |
+
|
54 |
+
Click on the 'Export User Data' link in the 'Users' menu, choose the role and the date range or don't select anything if you want to export all users, then click 'Export'. That's all!
|
55 |
+
|
56 |
+
== Screenshots ==
|
57 |
+
|
58 |
+
1. User export screen
|
59 |
+
|
60 |
+
== Changelog ==
|
61 |
+
|
62 |
+
= 0.5 =
|
63 |
+
* First public release.
|
64 |
+
|
65 |
+
== Upgrade Notice ==
|
66 |
+
|
67 |
+
= 0.5 =
|
68 |
+
First release.
|
tags/0.6/screenshot-1.png
ADDED
Binary file
|
trunk/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 |
+
}
|
trunk/export-user-data.php
ADDED
@@ -0,0 +1,605 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
14 |
+
Text Domain: export-user-data
|
15 |
+
*/
|
16 |
+
|
17 |
+
/*
|
18 |
+
* Based on: Export User to CSV by PubPoet ( http://pubpoet.com/ )- Thanks!
|
19 |
+
*/
|
20 |
+
|
21 |
+
load_plugin_textdomain( 'export-user-data', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Main plugin class
|
25 |
+
*
|
26 |
+
* @since 0.1
|
27 |
+
**/
|
28 |
+
class Q_EUD_Export_Users {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Class contructor
|
32 |
+
*
|
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);
|
66 |
+
$value = str_replace("\n", '', $value);
|
67 |
+
$value = str_replace("\t", '', $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 |
+
*
|
98 |
+
* @since 0.1
|
99 |
+
**/
|
100 |
+
public function generate_data() {
|
101 |
+
if ( isset( $_POST['_wpnonce-q-eud-export-user-page_export'] ) ) {
|
102 |
+
check_admin_referer( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' );
|
103 |
+
|
104 |
+
// build argument array ##
|
105 |
+
$args = array(
|
106 |
+
'fields' => 'all_with_meta',
|
107 |
+
'role' => stripslashes( $_POST['role'] )
|
108 |
+
);
|
109 |
+
|
110 |
+
// did the user request a specific program ? ##
|
111 |
+
if ( isset( $_POST['program'] ) && $_POST['program'] != '' ) {
|
112 |
+
|
113 |
+
$args['meta_key'] = 'member_of_club';
|
114 |
+
$args['meta_value'] = (int)$_POST['program'];
|
115 |
+
$args['meta_compare'] = '=';
|
116 |
+
|
117 |
+
}
|
118 |
+
|
119 |
+
add_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
120 |
+
$users = get_users( $args );
|
121 |
+
remove_action( 'pre_user_query', array( $this, 'pre_user_query' ) );
|
122 |
+
|
123 |
+
if ( ! $users ) {
|
124 |
+
$referer = add_query_arg( 'error', 'empty', wp_get_referer() );
|
125 |
+
wp_redirect( $referer );
|
126 |
+
exit;
|
127 |
+
}
|
128 |
+
|
129 |
+
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
130 |
+
if ( ! empty( $sitename ) )
|
131 |
+
$sitename .= '.';
|
132 |
+
|
133 |
+
// export method ? ##
|
134 |
+
$export_method = 'excel'; // default to Excel export ##
|
135 |
+
if ( isset( $_POST['format'] ) && $_POST['format'] != '' ) {
|
136 |
+
|
137 |
+
$export_method = $_POST['format'];
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
// set export filename structure ##
|
142 |
+
$filename = $sitename . 'users.' . date( 'Y-m-d-H-i-s' );
|
143 |
+
|
144 |
+
switch ( $export_method ) {
|
145 |
+
|
146 |
+
case "csv":
|
147 |
+
|
148 |
+
// to csv ##
|
149 |
+
header( 'Content-Description: File Transfer' );
|
150 |
+
header( 'Content-Disposition: attachment; filename='.$filename.'.csv' );
|
151 |
+
header( 'Content-Type: text/csv; charset=' . get_option( 'blog_charset' ), true );
|
152 |
+
|
153 |
+
// how to seperate data ##
|
154 |
+
$seperator = ','; // comma for csv ##
|
155 |
+
|
156 |
+
break;
|
157 |
+
|
158 |
+
case ('excel'):
|
159 |
+
|
160 |
+
// to xls ##
|
161 |
+
header( 'Content-Description: File Transfer' );
|
162 |
+
header("Content-Type: application/vnd.ms-excel");
|
163 |
+
header("Content-Disposition: attachment; filename=$filename.xls");
|
164 |
+
header("Pragma: no-cache");
|
165 |
+
header("Expires: 0");
|
166 |
+
|
167 |
+
// how to seperate data ##
|
168 |
+
$seperator = "\t"; //tabbed character
|
169 |
+
|
170 |
+
break;
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
// line break ##
|
175 |
+
$breaker = "\n";
|
176 |
+
|
177 |
+
// function to exclude data ##
|
178 |
+
$exclude_data = apply_filters( 'q_eud_exclude_data', array() );
|
179 |
+
|
180 |
+
// check for selected usermeta fields ##
|
181 |
+
$usermeta = $_POST['usermeta'];
|
182 |
+
$usermeta_fields = array();
|
183 |
+
foreach( $usermeta as $field ) {
|
184 |
+
$usermeta_fields[] = $field;
|
185 |
+
}
|
186 |
+
|
187 |
+
// check for selected x profile fields ##
|
188 |
+
$bp_fields = $_POST['bp_fields'];
|
189 |
+
$bp_fields_passed = array();
|
190 |
+
foreach( $bp_fields as $field ) {
|
191 |
+
|
192 |
+
// reverse tidy ##
|
193 |
+
$field = str_replace( '__', ' ', $field );
|
194 |
+
|
195 |
+
// add to array ##
|
196 |
+
$bp_fields_passed[] = $field;
|
197 |
+
|
198 |
+
}
|
199 |
+
|
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',
|
207 |
+
'user_registered', /*'user_activation_key',*/ /*'user_status',*/
|
208 |
+
'display_name'
|
209 |
+
);
|
210 |
+
|
211 |
+
// compile final fields list ##
|
212 |
+
$fields = array_merge( $data_keys, $usermeta_fields, $bp_fields_passed );
|
213 |
+
|
214 |
+
// build the document headers ##
|
215 |
+
$headers = array();
|
216 |
+
foreach ( $fields as $key => $field ) {
|
217 |
+
|
218 |
+
// rename programs field ##
|
219 |
+
if ( $field == 'member_of_club' ){
|
220 |
+
$field = 'Program';
|
221 |
+
}
|
222 |
+
|
223 |
+
if ( in_array( $field, $exclude_data ) )
|
224 |
+
unset( $fields[$key] );
|
225 |
+
else
|
226 |
+
$headers[] = '"' . $field . '"';
|
227 |
+
|
228 |
+
}
|
229 |
+
|
230 |
+
// echo headers ##
|
231 |
+
echo implode( $seperator, $headers ) . $breaker;
|
232 |
+
|
233 |
+
// build row values for each user ##
|
234 |
+
foreach ( $users as $user ) {
|
235 |
+
|
236 |
+
$data = array();
|
237 |
+
foreach ( $fields as $field ) {
|
238 |
+
|
239 |
+
// BP loaded ? ##
|
240 |
+
if ( function_exists ('bp_is_active') ) {
|
241 |
+
$bp_data = BP_XProfile_ProfileData::get_all_for_user($user->ID);
|
242 |
+
}
|
243 |
+
|
244 |
+
// check if this is a BP field ##
|
245 |
+
if ( in_array( $field, $bp_fields_passed ) ) {
|
246 |
+
|
247 |
+
$value = $bp_data[$field];
|
248 |
+
|
249 |
+
if (is_array($value)) {
|
250 |
+
$value = $value['field_data'];
|
251 |
+
}
|
252 |
+
$value = $this->sanitize($value);
|
253 |
+
|
254 |
+
// user data or usermeta ##
|
255 |
+
} else {
|
256 |
+
|
257 |
+
$value = isset( $user->{$field} ) ? $user->{$field} : '';
|
258 |
+
$value = is_array( $value ) ? serialize( $value ) : $value;
|
259 |
+
|
260 |
+
}
|
261 |
+
|
262 |
+
// correct program value to Program Name ##
|
263 |
+
if ( $field == 'member_of_club' ){
|
264 |
+
$value = get_the_title($value);
|
265 |
+
}
|
266 |
+
|
267 |
+
$data[] = '"' . str_replace( '"', '""', $value ) . '"';
|
268 |
+
|
269 |
+
}
|
270 |
+
|
271 |
+
// echo row data ##
|
272 |
+
echo implode( $seperator, $data ) . $breaker;
|
273 |
+
}
|
274 |
+
|
275 |
+
// stop PHP, so file can export correctly ##
|
276 |
+
exit;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Content of the settings page
|
282 |
+
*
|
283 |
+
* @since 0.1
|
284 |
+
**/
|
285 |
+
public function users_page() {
|
286 |
+
if ( ! current_user_can( 'list_users' ) ) {
|
287 |
+
wp_die( __( 'You do not have sufficient permissions to access this page.', 'export-user-data' ) );
|
288 |
+
}
|
289 |
+
?>
|
290 |
+
|
291 |
+
<div class="wrap">
|
292 |
+
<h2><?php _e( 'Export User Data', 'export-user-data' ); ?></h2>
|
293 |
+
<?php
|
294 |
+
|
295 |
+
// nothing happening? ##
|
296 |
+
if ( isset( $_GET['error'] ) ) {
|
297 |
+
echo '<div class="updated"><p><strong>' . __( 'No users found.', 'export-user-data' ) . '</strong></p></div>';
|
298 |
+
}
|
299 |
+
|
300 |
+
?>
|
301 |
+
<form method="post" action="" enctype="multipart/form-data">
|
302 |
+
<?php wp_nonce_field( 'q-eud-export-user-page_export', '_wpnonce-q-eud-export-user-page_export' ); ?>
|
303 |
+
<table class="form-table">
|
304 |
+
<?php
|
305 |
+
|
306 |
+
// allow admin to select user meta fields to export ##
|
307 |
+
global $wpdb;
|
308 |
+
$meta_keys = $wpdb->get_results( "SELECT distinct(meta_key) FROM $wpdb->usermeta" );
|
309 |
+
|
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_',
|
318 |
+
'nav_',
|
319 |
+
'wp_',
|
320 |
+
'admin_color',
|
321 |
+
'wpmudev',
|
322 |
+
'screen_',
|
323 |
+
'show_',
|
324 |
+
'rich_',
|
325 |
+
'reward_',
|
326 |
+
'meta-box',
|
327 |
+
'manageedit',
|
328 |
+
'edit_',
|
329 |
+
'closedpostboxes_',
|
330 |
+
'dismissed_',
|
331 |
+
'manage',
|
332 |
+
'comment',
|
333 |
+
'current',
|
334 |
+
'incentive_',
|
335 |
+
'_wdp',
|
336 |
+
'ssl',
|
337 |
+
'wdfb',
|
338 |
+
'users_per_page',
|
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 |
+
|
351 |
+
#echo 'FOUND -- '.$drop.' in '.$key.'<br />';
|
352 |
+
|
353 |
+
if(($key = array_search($key, $meta_keys)) !== false) {
|
354 |
+
unset($meta_keys[$key]);
|
355 |
+
}
|
356 |
+
|
357 |
+
}
|
358 |
+
|
359 |
+
}
|
360 |
+
|
361 |
+
}
|
362 |
+
*/
|
363 |
+
|
364 |
+
// test array ##
|
365 |
+
#echo '<pre>'; var_dump($meta_keys); echo '</pre>';
|
366 |
+
|
367 |
+
// check if we got anything ? ##
|
368 |
+
if ( $meta_keys ) {
|
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
|
427 |
+
|
428 |
+
} // meta_keys found ##
|
429 |
+
|
430 |
+
?>
|
431 |
+
<?php
|
432 |
+
|
433 |
+
// buddypress x profile data ##
|
434 |
+
if ( function_exists ('bp_is_active') ) {
|
435 |
+
|
436 |
+
// grab all buddypress x profile fields ##
|
437 |
+
$bp_fields = $wpdb->get_results( "SELECT distinct(name) FROM ".$wpdb->base_prefix."bp_xprofile_fields WHERE parent_id = 0" );
|
438 |
+
|
439 |
+
// get name value from object ##
|
440 |
+
$bp_fields = wp_list_pluck( $bp_fields, 'name' );
|
441 |
+
|
442 |
+
// test array ##
|
443 |
+
#echo '<pre>'; var_dump($bp_fields); echo '</pre>';
|
444 |
+
|
445 |
+
// allow array to be filtered ##
|
446 |
+
$bp_fields = apply_filters( 'export_user_data_bp_fields', $bp_fields );
|
447 |
+
|
448 |
+
?>
|
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 ) {
|
456 |
+
|
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
|
471 |
+
|
472 |
+
} // BP installed and active ##
|
473 |
+
|
474 |
+
?>
|
475 |
+
<tr valign="top">
|
476 |
+
<th scope="row"><label for="q_eud_users_role"><?php _e( 'Role', 'export-user-data' ); ?></label></th>
|
477 |
+
<td>
|
478 |
+
<select name="role" id="q_eud_users_role">
|
479 |
+
<?php
|
480 |
+
|
481 |
+
echo '<option value="">' . __( 'All Roles', 'export-user-data' ) . '</option>';
|
482 |
+
global $wp_roles;
|
483 |
+
foreach ( $wp_roles->role_names as $role => $name ) {
|
484 |
+
echo "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
485 |
+
}
|
486 |
+
|
487 |
+
?>
|
488 |
+
</select>
|
489 |
+
</td>
|
490 |
+
</tr>
|
491 |
+
<?php
|
492 |
+
|
493 |
+
// clubs ? ##
|
494 |
+
if ( post_type_exists( 'club' ) ) {
|
495 |
+
|
496 |
+
?>
|
497 |
+
<tr valign="top">
|
498 |
+
<th scope="row"><label for="q_eud_users_program"><?php _e( 'Programs', 'export-user-data' ); ?></label></th>
|
499 |
+
<td>
|
500 |
+
<select name="program" id="q_eud_users_program">
|
501 |
+
<?php
|
502 |
+
|
503 |
+
echo '<option value="">' . __( 'All Programs', 'export-user-data' ) . '</option>';
|
504 |
+
|
505 |
+
$clubs_array = get_posts(array( 'post_type'=> 'club', 'posts_per_page' => -1 )); // grab all posts of type "club" ##
|
506 |
+
|
507 |
+
foreach ( $clubs_array as $c ) { // loop over all clubs ##
|
508 |
+
|
509 |
+
#$clubs[$c->ID] = $c; // grab club ID ##
|
510 |
+
echo "\n\t<option value='" . esc_attr( $c->ID ) . "'>$c->post_title</option>";
|
511 |
+
|
512 |
+
}
|
513 |
+
|
514 |
+
?>
|
515 |
+
</select>
|
516 |
+
</td>
|
517 |
+
</tr>
|
518 |
+
<?php
|
519 |
+
|
520 |
+
} // clubs ##
|
521 |
+
|
522 |
+
?>
|
523 |
+
<tr valign="top">
|
524 |
+
<th scope="row"><label><?php _e( 'Registred', 'export-user-data' ); ?></label></th>
|
525 |
+
<td>
|
526 |
+
<select name="start_date" id="q_eud_users_start_date">
|
527 |
+
<option value="0"><?php _e( 'Start Date', 'export-user-data' ); ?></option>
|
528 |
+
<?php $this->export_date_options(); ?>
|
529 |
+
</select>
|
530 |
+
<select name="end_date" id="q_eud_users_end_date">
|
531 |
+
<option value="0"><?php _e( 'End Date', 'export-user-data' ); ?></option>
|
532 |
+
<?php $this->export_date_options(); ?>
|
533 |
+
</select>
|
534 |
+
</td>
|
535 |
+
</tr>
|
536 |
+
|
537 |
+
<tr valign="top">
|
538 |
+
<th scope="row"><label for="q_eud_users_format"><?php _e( 'Format', 'export-user-data' ); ?></label></th>
|
539 |
+
<td>
|
540 |
+
<select name="format" id="q_eud_users_format">
|
541 |
+
<?php
|
542 |
+
|
543 |
+
echo '<option value="excel">' . __( 'Excel', 'export-user-data' ) . '</option>';
|
544 |
+
echo '<option value="csv">' . __( 'CSV', 'export-user-data' ) . '</option>';
|
545 |
+
|
546 |
+
?>
|
547 |
+
</select>
|
548 |
+
</td>
|
549 |
+
</tr>
|
550 |
+
</table>
|
551 |
+
<p class="submit">
|
552 |
+
<input type="hidden" name="_wp_http_referer" value="<?php echo $_SERVER['REQUEST_URI'] ?>" />
|
553 |
+
<input type="submit" class="button-primary" value="<?php _e( 'Export', 'export-user-data' ); ?>" />
|
554 |
+
</p>
|
555 |
+
</form>
|
556 |
+
<?php
|
557 |
+
}
|
558 |
+
|
559 |
+
// data to exclude from export ##
|
560 |
+
public function exclude_data() {
|
561 |
+
$exclude = array( 'user_pass', 'user_activation_key' );
|
562 |
+
return $exclude;
|
563 |
+
}
|
564 |
+
|
565 |
+
public function pre_user_query( $user_search ) {
|
566 |
+
global $wpdb;
|
567 |
+
|
568 |
+
$where = '';
|
569 |
+
|
570 |
+
if ( ! empty( $_POST['start_date'] ) )
|
571 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered >= %s", date( 'Y-m-d', strtotime( $_POST['start_date'] ) ) );
|
572 |
+
|
573 |
+
if ( ! empty( $_POST['end_date'] ) )
|
574 |
+
$where .= $wpdb->prepare( " AND $wpdb->users.user_registered < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $_POST['end_date'] ) ) ) );
|
575 |
+
|
576 |
+
if ( ! empty( $where ) )
|
577 |
+
$user_search->query_where = str_replace( 'WHERE 1=1', "WHERE 1=1 $where", $user_search->query_where );
|
578 |
+
|
579 |
+
return $user_search;
|
580 |
+
}
|
581 |
+
|
582 |
+
private function export_date_options() {
|
583 |
+
global $wpdb, $wp_locale;
|
584 |
+
|
585 |
+
$months = $wpdb->get_results( "
|
586 |
+
SELECT DISTINCT YEAR( user_registered ) AS year, MONTH( user_registered ) AS month
|
587 |
+
FROM $wpdb->users
|
588 |
+
ORDER BY user_registered DESC
|
589 |
+
" );
|
590 |
+
|
591 |
+
$month_count = count( $months );
|
592 |
+
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
|
593 |
+
return;
|
594 |
+
|
595 |
+
foreach ( $months as $date ) {
|
596 |
+
if ( 0 == $date->year )
|
597 |
+
continue;
|
598 |
+
|
599 |
+
$month = zeroise( $date->month, 2 );
|
600 |
+
echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';
|
601 |
+
}
|
602 |
+
}
|
603 |
+
}
|
604 |
+
|
605 |
+
new Q_EUD_Export_Users;
|
trunk/img/switch.png
ADDED
Binary file
|
trunk/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);
|
trunk/languages/default.mo
ADDED
Binary file
|
trunk/languages/default.po
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.5.4\n"
|
14 |
+
"X-Poedit-KeywordsList: _;_e;_n;__\n"
|
15 |
+
"X-Poedit-Basepath: .\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 ""
|
trunk/readme.txt
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
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.3
|
7 |
+
License: GPLv2
|
8 |
+
|
9 |
+
Export users data, metadata and buddypress xprofile data to a csv or Excel file
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
A plugin that exports ALL user data, meta data and BuddyPress xProfile data.
|
14 |
+
|
15 |
+
Includes an option to export the users by role, registration date range, usermeta option and two export formats.
|
16 |
+
|
17 |
+
Based on: http://wordpress.org/plugins/export-users-to-csv/
|
18 |
+
|
19 |
+
= Features =
|
20 |
+
|
21 |
+
* Exports all users fields
|
22 |
+
* Exports users meta
|
23 |
+
* Exports users by role
|
24 |
+
* Exports users by date range
|
25 |
+
* Export user BuddyPress xProfile data
|
26 |
+
|
27 |
+
For feature request and bug reports, [please use the forums](http://wordpress.org/tags/export-users-data).
|
28 |
+
|
29 |
+
== Installation ==
|
30 |
+
|
31 |
+
For an automatic installation through WordPress:
|
32 |
+
|
33 |
+
1. Go to the 'Add New' plugins screen in your WordPress admin area
|
34 |
+
1. Search for 'Export User Data'
|
35 |
+
1. Click 'Install Now' and activate the plugin
|
36 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
37 |
+
|
38 |
+
|
39 |
+
For a manual installation via FTP:
|
40 |
+
|
41 |
+
1. Upload the `export-user-data` directory to the `/wp-content/plugins/` directory
|
42 |
+
1. Activate the plugin through the 'Plugins' screen in your WordPress admin area
|
43 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
44 |
+
|
45 |
+
|
46 |
+
To upload the plugin through WordPress, instead of FTP:
|
47 |
+
|
48 |
+
1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
|
49 |
+
1. Go the 'Users' menu, under 'Export User Data'
|
50 |
+
|
51 |
+
== Frequently Asked Questions ==
|
52 |
+
|
53 |
+
= How to use? =
|
54 |
+
|
55 |
+
Click on the 'Export User Data' link in the 'Users' menu, choose the role and the date range or don't select anything if you want to export all users, then click 'Export'. That's all!
|
56 |
+
|
57 |
+
== Screenshots ==
|
58 |
+
|
59 |
+
1. User export screen
|
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.
|
trunk/screenshot-1.png
ADDED
Binary file
|