Ultimate Member – User Profile & Membership Plugin - Version 1.2.95

Version Description

Download this release

Release Info

Developer ultimatemember
Plugin Icon 128x128 Ultimate Member – User Profile & Membership Plugin
Version 1.2.95
Comparing to
See all releases

Code changes from version 1.2.94 to 1.2.95

admin/core/um-admin-users.php CHANGED
@@ -327,6 +327,7 @@ class UM_Admin_Users {
327
 
328
  if ( $this->custom_role == $column_name ) {
329
 
 
330
  um_fetch_user( $user_id );
331
  return um_user('role_name');
332
 
327
 
328
  if ( $this->custom_role == $column_name ) {
329
 
330
+ delete_option( "um_cache_userdata_{$user_id}" );
331
  um_fetch_user( $user_id );
332
  return um_user('role_name');
333
 
core/um-account.php CHANGED
@@ -72,7 +72,7 @@ class UM_Account {
72
  global $ultimatemember;
73
 
74
  if ( um_is_core_page('account') && !is_user_logged_in() ) {
75
- um_redirect_home();
76
  }
77
 
78
  if ( um_is_core_page('account') ) {
72
  global $ultimatemember;
73
 
74
  if ( um_is_core_page('account') && !is_user_logged_in() ) {
75
+ exit( wp_redirect( add_query_arg('redirect_to', urlencode( um_get_core_page('account') ) , um_get_core_page('login') ) ) );
76
  }
77
 
78
  if ( um_is_core_page('account') ) {
core/um-actions-form.php CHANGED
@@ -196,7 +196,9 @@
196
  }
197
 
198
  if ( isset( $array['html'] ) && $array['html'] == 0 ) {
199
- $args[$key] = strip_tags( $args[$key] );
 
 
200
  }
201
 
202
  if ( isset( $array['force_good_pass'] ) && $array['force_good_pass'] == 1 ) {
196
  }
197
 
198
  if ( isset( $array['html'] ) && $array['html'] == 0 ) {
199
+ if ( wp_strip_all_tags( $args[$key] ) != $args[$key] ) {
200
+ $ultimatemember->form->add_error($key, __('You can not use HTML tags here','ultimatemember') );
201
+ }
202
  }
203
 
204
  if ( isset( $array['force_good_pass'] ) && $array['force_good_pass'] == 1 ) {
core/um-actions-login.php CHANGED
@@ -106,8 +106,9 @@
106
 
107
  }
108
 
109
- if ( isset( $args['form_id'] ) && $args['form_id'] == $ultimatemember->shortcodes->core_login_form() && $ultimatemember->form->errors )
110
  exit( wp_redirect( um_get_core_page('login') ) );
 
111
 
112
  }
113
 
106
 
107
  }
108
 
109
+ if ( isset( $args['form_id'] ) && $args['form_id'] == $ultimatemember->shortcodes->core_login_form() && $ultimatemember->form->errors && !isset( $_POST[ $ultimatemember->honeypot ] ) ) {
110
  exit( wp_redirect( um_get_core_page('login') ) );
111
+ }
112
 
113
  }
114
 
core/um-actions-profile.php CHANGED
@@ -92,7 +92,7 @@
92
  }
93
 
94
  if ( isset( $args['submitted']['description'] ) ) {
95
- $to_update['description'] = $ultimatemember->validation->remove_html( $args['submitted']['description'] );
96
  }
97
 
98
  if ( isset( $args['submitted']['role'] ) && !empty( $args['submitted']['role'] ) ) {
92
  }
93
 
94
  if ( isset( $args['submitted']['description'] ) ) {
95
+ $to_update['description'] = $args['submitted']['description'];
96
  }
97
 
98
  if ( isset( $args['submitted']['role'] ) && !empty( $args['submitted']['role'] ) ) {
core/um-actions-wpadmin.php CHANGED
@@ -10,6 +10,9 @@
10
  // Logout screen
11
  if ( isset( $pagenow ) && $pagenow == 'wp-login.php' && is_user_logged_in() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'logout' ) {
12
  $redirect = um_get_core_page('logout');
 
 
 
13
  exit( wp_redirect( $redirect ) );
14
  }
15
 
10
  // Logout screen
11
  if ( isset( $pagenow ) && $pagenow == 'wp-login.php' && is_user_logged_in() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'logout' ) {
12
  $redirect = um_get_core_page('logout');
13
+ if ( isset( $_REQUEST['redirect_to'] ) && !empty( $_REQUEST['redirect_to'] ) ) {
14
+ $redirect = add_query_arg( 'redirect_to', $_REQUEST['redirect_to'], $redirect );
15
+ }
16
  exit( wp_redirect( $redirect ) );
17
  }
18
 
core/um-api.php CHANGED
@@ -52,6 +52,7 @@ class UM_REST_API {
52
  $vars[] = 'type';
53
  $vars[] = 'data';
54
  $vars[] = 'fields';
 
55
  $vars[] = 'number';
56
  $vars[] = 'id';
57
  $vars[] = 'email';
@@ -189,6 +190,10 @@ class UM_REST_API {
189
 
190
  switch( $query_mode ) :
191
 
 
 
 
 
192
  case 'get.users':
193
  $data = $this->get_users( $args );
194
  break;
@@ -196,6 +201,14 @@ class UM_REST_API {
196
  case 'get.user':
197
  $data = $this->get_auser( $args );
198
  break;
 
 
 
 
 
 
 
 
199
 
200
  case 'get.following':
201
  $data = $this->get_following( $args );
@@ -217,6 +230,100 @@ class UM_REST_API {
217
  $this->output();
218
  }
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  /**
221
  * Process Get followers users API Request
222
  */
@@ -361,6 +468,35 @@ class UM_REST_API {
361
  return $response;
362
  }
363
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  /**
365
  * Process Get user API Request
366
  */
@@ -489,8 +625,11 @@ class UM_REST_API {
489
  $accepted = apply_filters( 'um_api_valid_query_modes', array(
490
  'get.users',
491
  'get.user',
 
 
492
  'get.following',
493
  'get.followers',
 
494
  ) );
495
 
496
  $query = isset( $wp_query->query_vars['um-api'] ) ? $wp_query->query_vars['um-api'] : null;
52
  $vars[] = 'type';
53
  $vars[] = 'data';
54
  $vars[] = 'fields';
55
+ $vars[] = 'value';
56
  $vars[] = 'number';
57
  $vars[] = 'id';
58
  $vars[] = 'email';
190
 
191
  switch( $query_mode ) :
192
 
193
+ case 'get.stats':
194
+ $data = $this->get_stats( $args );
195
+ break;
196
+
197
  case 'get.users':
198
  $data = $this->get_users( $args );
199
  break;
201
  case 'get.user':
202
  $data = $this->get_auser( $args );
203
  break;
204
+
205
+ case 'update.user':
206
+ $data = $this->update_user( $args );
207
+ break;
208
+
209
+ case 'delete.user':
210
+ $data = $this->delete_user( $args );
211
+ break;
212
 
213
  case 'get.following':
214
  $data = $this->get_following( $args );
230
  $this->output();
231
  }
232
 
233
+ /**
234
+ * Get some stats
235
+ */
236
+ public function get_stats( $args ) {
237
+ global $wpdb, $ultimatemember;
238
+ extract( $args );
239
+
240
+ $response = array();
241
+ $error = array();
242
+
243
+ $query = "SELECT COUNT(*) FROM {$wpdb->prefix}users";
244
+ $count = absint( $wpdb->get_var($query) );
245
+ $response['stats']['total_users'] = $count;
246
+
247
+ include_once um_path . 'admin/core/um-admin-dashboard.php';
248
+ $pending = $um_dashboard->get_pending_users_count();
249
+ $response['stats']['pending_users'] = absint( $pending );
250
+
251
+ if ( class_exists( 'UM_Notifications_API') ) {
252
+ $query = "SELECT COUNT(*) FROM {$wpdb->prefix}um_notifications";
253
+ $total_notifications = absint( $wpdb->get_var( $query ) );
254
+ $response['stats']['total_notifications'] = $total_notifications;
255
+ }
256
+
257
+ if ( class_exists( 'UM_Messaging_API') ) {
258
+ $query = "SELECT COUNT(*) FROM {$wpdb->prefix}um_conversations";
259
+ $total_conversations = absint( $wpdb->get_var( $query ) );
260
+ $response['stats']['total_conversations'] = $total_conversations;
261
+
262
+ $query = "SELECT COUNT(*) FROM {$wpdb->prefix}um_messages";
263
+ $total_messages = absint( $wpdb->get_var( $query ) );
264
+ $response['stats']['total_messages'] = $total_messages;
265
+ }
266
+
267
+ if ( class_exists( 'UM_Online_API') ) {
268
+ global $um_online;
269
+ $total_online = count( $um_online->get_users() );
270
+ $response['stats']['total_online'] = $total_online;
271
+ }
272
+
273
+ if ( class_exists( 'UM_Reviews_API') ) {
274
+ $query = "SELECT COUNT(*) FROM {$wpdb->prefix}posts WHERE post_status='publish' AND post_type='um_review'";
275
+ $total_reviews = absint( $wpdb->get_var( $query ) );
276
+ $response['stats']['total_reviews'] = $total_reviews;
277
+ }
278
+
279
+ return $response;
280
+ }
281
+
282
+ /**
283
+ * Update user API query
284
+ */
285
+ public function update_user( $args ) {
286
+ global $ultimatemember;
287
+ extract( $args );
288
+
289
+ $response = array();
290
+ $error = array();
291
+
292
+ if ( !$id ) {
293
+ $error['error'] = __('You must provide a user ID','ultimatemember');
294
+ return $error;
295
+ }
296
+
297
+ if ( !$data ) {
298
+ $error['error'] = __('You need to provide data to update','ultimatemember');
299
+ return $error;
300
+ }
301
+
302
+ um_fetch_user( $id );
303
+
304
+ switch ( $data ) {
305
+ case 'status':
306
+ $ultimatemember->user->set_status( $value );
307
+ $response['success'] = __('User status has been changed.','ultimatemember');
308
+ break;
309
+ case 'role':
310
+ $ultimatemember->user->set_role( $value );
311
+ $response['success'] = __('User level has been changed.','ultimatemember');
312
+ break;
313
+ case 'wp_role':
314
+ $wp_user_object = new WP_User( $id );
315
+ $wp_user_object->set_role( $value );
316
+ $response['success'] = __('User WordPress role has been changed.','ultimatemember');
317
+ break;
318
+ default:
319
+ update_user_meta( $id, $data, esc_attr( $value ) );
320
+ $response['success'] = __('User meta has been changed.','ultimatemember');
321
+ break;
322
+ }
323
+
324
+ return $response;
325
+ }
326
+
327
  /**
328
  * Process Get followers users API Request
329
  */
468
  return $response;
469
  }
470
 
471
+ /**
472
+ * Process delete user via API
473
+ */
474
+ public function delete_user( $args ) {
475
+ global $ultimatemember;
476
+ extract( $args );
477
+
478
+ $response = array();
479
+ $error = array();
480
+
481
+ if ( !isset( $id ) ) {
482
+ $error['error'] = __('You must provide a user ID','ultimatemember');
483
+ return $error;
484
+ }
485
+
486
+ $user = get_userdata( $id );
487
+ if ( !$user ) {
488
+ $error['error'] = __('Invalid user specified','ultimatemember');
489
+ return $error;
490
+ }
491
+
492
+ um_fetch_user( $id );
493
+ $ultimatemember->user->delete();
494
+
495
+ $response['success'] = __('User has been successfully deleted.','ultimatemember');
496
+
497
+ return $response;
498
+ }
499
+
500
  /**
501
  * Process Get user API Request
502
  */
625
  $accepted = apply_filters( 'um_api_valid_query_modes', array(
626
  'get.users',
627
  'get.user',
628
+ 'update.user',
629
+ 'delete.user',
630
  'get.following',
631
  'get.followers',
632
+ 'get.stats',
633
  ) );
634
 
635
  $query = isset( $wp_query->query_vars['um-api'] ) ? $wp_query->query_vars['um-api'] : null;
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ultimate Member
4
  Plugin URI: http://ultimatemember.com/
5
  Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
6
- Version: 1.2.94
7
  Author: Ultimate Member
8
  Author URI: http://ultimatemember.com/
9
  */
3
  Plugin Name: Ultimate Member
4
  Plugin URI: http://ultimatemember.com/
5
  Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
6
+ Version: 1.2.95
7
  Author: Ultimate Member
8
  Author URI: http://ultimatemember.com/
9
  */
readme.txt CHANGED
@@ -5,9 +5,9 @@ Contributors: ultimatemember
5
  Donate link:
6
  Tags: access control, author, authors, author profile, comments, community, communities, conditional fields, conditional logic, conditional menus, content protection, custom fields, file uploads, form builder, front-end login, front-end registration, gravatar, hide wp-admin, login, login page, logged-in users, mandrill, member, members, membership, member directory, online users, profile, profiles, profile builder, registration, restriction, restrict content, role creation, role menus, search filters, sign in, sign up, social network, star ratings, toolbar, user, users, user fields, user profile, user-profile, user profiles, user roles
7
  Requires at least: 4.1
8
- Tested up to: 4.2.1
9
 
10
- Stable Tag: 1.2.94
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
@@ -79,6 +79,8 @@ Ultimate Member has been translated into the following languages:
79
  * German - Deutsch
80
  * Dutch - Nederlands
81
  * Finnish - Suomi
 
 
82
  * Polish - Polski
83
  * Russian - Русский
84
  * Turkish - Türkçe
@@ -141,6 +143,16 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
 
 
 
 
 
144
  = 1.2.94: May 6, 2015 =
145
 
146
  * Fixed: bug with activation e-mails
5
  Donate link:
6
  Tags: access control, author, authors, author profile, comments, community, communities, conditional fields, conditional logic, conditional menus, content protection, custom fields, file uploads, form builder, front-end login, front-end registration, gravatar, hide wp-admin, login, login page, logged-in users, mandrill, member, members, membership, member directory, online users, profile, profiles, profile builder, registration, restriction, restrict content, role creation, role menus, search filters, sign in, sign up, social network, star ratings, toolbar, user, users, user fields, user profile, user-profile, user profiles, user roles
7
  Requires at least: 4.1
8
+ Tested up to: 4.2.2
9
 
10
+ Stable Tag: 1.2.95
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
79
  * German - Deutsch
80
  * Dutch - Nederlands
81
  * Finnish - Suomi
82
+ * Danish - Dansk
83
+ * Swedish - Svenska
84
  * Polish - Polski
85
  * Russian - Русский
86
  * Turkish - Türkçe
143
 
144
  == Changelog ==
145
 
146
+ = 1.2.95: May 9, 2015 =
147
+
148
+ * New: RESTful API methods update.user, get.stats, and delete.user
149
+ * New: added Danish (Dansk) support
150
+ * New: added Swedish (Svenska) support
151
+ * Tweak: minor account and logout redirection tweaks
152
+ * Fixed: issue with changing user role
153
+ * Fixed: bug with login form validation
154
+ * Fixed: issue with biography field and html
155
+
156
  = 1.2.94: May 6, 2015 =
157
 
158
  * Fixed: bug with activation e-mails
um-init.php CHANGED
@@ -24,6 +24,8 @@ class UM_API {
24
  'de_DE' => 'Deutsch',
25
  'nl_NL' => 'Nederlands',
26
  'fi_FI' => 'Suomi',
 
 
27
  'pl_PL' => 'Polski',
28
  'ru_RU' => 'Русский',
29
  'tr_TR' => 'Türkçe',
24
  'de_DE' => 'Deutsch',
25
  'nl_NL' => 'Nederlands',
26
  'fi_FI' => 'Suomi',
27
+ 'da_DK' => 'Dansk',
28
+ 'sv_SE' => 'Svenska',
29
  'pl_PL' => 'Polski',
30
  'ru_RU' => 'Русский',
31
  'tr_TR' => 'Türkçe',