Ultimate Member – User Profile & Membership Plugin - Version 1.0.89

Version Description

Download this release

Release Info

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

Code changes from version 1.0.88 to 1.0.89

admin/core/um-admin-dashboard.php CHANGED
@@ -10,7 +10,8 @@ class UM_Admin_Dashboard {
10
  $this->about_tabs['start'] = 'Getting Started';
11
 
12
  add_action('admin_menu', array(&$this, 'primary_admin_menu'), 0);
13
- add_action('admin_menu', array(&$this, 'secondary_menu_items'), 1000);
 
14
 
15
  }
16
 
@@ -43,11 +44,16 @@ class UM_Admin_Dashboard {
43
  }
44
 
45
  do_action('um_extend_admin_menu');
46
-
47
- add_submenu_page( $this->slug, __('Extensions', $this->slug), '<span style="color: #3dc3e5">' .__('Extensions', $this->slug) . '</span>', 'manage_options', $this->slug . '-extensions', array(&$this, 'admin_page') );
48
 
49
  }
50
 
 
 
 
 
 
 
 
51
  /***
52
  *** @load metabox stuff
53
  ***/
10
  $this->about_tabs['start'] = 'Getting Started';
11
 
12
  add_action('admin_menu', array(&$this, 'primary_admin_menu'), 0);
13
+ add_action('admin_menu', array(&$this, 'secondary_menu_items'), 1000);
14
+ add_action('admin_menu', array(&$this, 'extension_menu'), 9999);
15
 
16
  }
17
 
44
  }
45
 
46
  do_action('um_extend_admin_menu');
 
 
47
 
48
  }
49
 
50
+ /***
51
+ *** @extension menu
52
+ ***/
53
+ function extension_menu() {
54
+ add_submenu_page( $this->slug, __('Extensions', $this->slug), '<span style="color: #3dc3e5">' .__('Extensions', $this->slug) . '</span>', 'manage_options', $this->slug . '-extensions', array(&$this, 'admin_page') );
55
+ }
56
+
57
  /***
58
  *** @load metabox stuff
59
  ***/
admin/core/um-admin-metabox.php CHANGED
@@ -380,6 +380,8 @@ class UM_Admin_Metabox {
380
  update_post_meta( $post_id, $k, $v);
381
  }
382
  }
 
 
383
 
384
  }
385
 
380
  update_post_meta( $post_id, $k, $v);
381
  }
382
  }
383
+
384
+ do_action('um_admin_after_editing_role', $post_id, $post);
385
 
386
  }
387
 
core/um-cache.php CHANGED
@@ -6,8 +6,15 @@ class UM_Cache {
6
 
7
  add_action( 'init', array(&$this, 'do_not_cache' ) );
8
 
 
 
 
 
9
  }
10
 
 
 
 
11
  function do_not_cache() {
12
 
13
  if ( um_is_core_uri() ) {
@@ -15,5 +22,33 @@ class UM_Cache {
15
  }
16
 
17
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  }
6
 
7
  add_action( 'init', array(&$this, 'do_not_cache' ) );
8
 
9
+ add_action('um_admin_after_editing_role', array(&$this, 'delete_role_cache'), 10, 2 );
10
+
11
+ $this->role_data = get_option('um_cache_role_data');
12
+
13
  }
14
 
15
+ /***
16
+ *** @needed for some cache plugins
17
+ ***/
18
  function do_not_cache() {
19
 
20
  if ( um_is_core_uri() ) {
22
  }
23
 
24
  }
25
+
26
+ /***
27
+ *** @clear cached role data
28
+ ***/
29
+ function delete_role_cache( $post_id, $post ) {
30
+ $role_slug = $post->post_name;
31
+ if ( isset( $this->role_data[ $role_slug ] ) ) {
32
+ unset( $this->role_data[ $role_slug ] );
33
+ update_option('um_cache_role_data', $this->role_data);
34
+ }
35
+ }
36
+
37
+ /***
38
+ *** @get cached role data
39
+ ***/
40
+ function role_data( $role_slug ) {
41
+ if ( isset( $this->role_data[ $role_slug ] ) )
42
+ return $this->role_data[ $role_slug ];
43
+ return null;
44
+ }
45
+
46
+ /***
47
+ *** @set role data cache
48
+ ***/
49
+ function set_role_data( $role_slug, $array ) {
50
+ $this->role_data[ $role_slug ] = $array;
51
+ update_option('um_cache_role_data', $this->role_data);
52
+ }
53
 
54
  }
core/um-query.php CHANGED
@@ -183,6 +183,11 @@ class UM_Query {
183
  ***/
184
  function role_data( $role_slug ) {
185
  global $wpdb, $ultimatemember;
 
 
 
 
 
186
 
187
  if ($role_slug == 'admin' || $role_slug == 'member'){
188
  $try = $this->find_post_id('um_role','_um_core',$role_slug);
@@ -212,6 +217,10 @@ class UM_Query {
212
  $array = $ultimatemember->setup->get_initial_permissions( $role_slug );
213
 
214
  }
 
 
 
 
215
  return $array;
216
  }
217
 
@@ -246,31 +255,6 @@ class UM_Query {
246
  return $array;
247
  }
248
 
249
- /***
250
- *** @Counts all user posts
251
- ***/
252
- function count_posts($user_id){
253
- $args = array(
254
- 'author' => $user_id,
255
- 'post_status' => array('publish'),
256
- 'post_type' => 'any'
257
- );
258
- $posts = new WP_Query( $args );
259
- $post_count = $posts->found_posts;
260
- return $post_count;
261
- }
262
-
263
- /***
264
- *** @Count comments by user
265
- ***/
266
- function count_comments( $user_id ) {
267
- $args = array(
268
- 'user_id' => $user_id
269
- );
270
- $comments = get_comments( $args );
271
- return count($comments);
272
- }
273
-
274
  /***
275
  *** @Capture selected value
276
  ***/
183
  ***/
184
  function role_data( $role_slug ) {
185
  global $wpdb, $ultimatemember;
186
+
187
+ // get cache
188
+ if ( $ultimatemember->cache->role_data( $role_slug ) ) {
189
+ return $ultimatemember->cache->role_data( $role_slug );
190
+ }
191
 
192
  if ($role_slug == 'admin' || $role_slug == 'member'){
193
  $try = $this->find_post_id('um_role','_um_core',$role_slug);
217
  $array = $ultimatemember->setup->get_initial_permissions( $role_slug );
218
 
219
  }
220
+
221
+ // set cache
222
+ $ultimatemember->cache->set_role_data( $role_slug, $array );
223
+
224
  return $array;
225
  }
226
 
255
  return $array;
256
  }
257
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  /***
259
  *** @Capture selected value
260
  ***/
core/um-short-functions.php CHANGED
@@ -391,14 +391,8 @@ function um_profile_id() {
391
  *** @get a user's display name
392
  ***/
393
  function um_get_display_name( $user_id ) {
394
- global $ultimatemember;
395
-
396
- $ultimatemember->user->reset( true );
397
- $ultimatemember->user->set( $user_id );
398
- $cached = um_user('display_name');
399
- $ultimatemember->user->reset();
400
- return $cached;
401
-
402
  }
403
 
404
  /***
391
  *** @get a user's display name
392
  ***/
393
  function um_get_display_name( $user_id ) {
394
+ $user = get_userdata( $user_id );
395
+ return $user->display_name;
 
 
 
 
 
 
396
  }
397
 
398
  /***
core/um-user.php CHANGED
@@ -150,10 +150,6 @@ class UM_User {
150
  $this->profile[$k] = $v[0];
151
  }
152
 
153
- // add user stuff
154
- $this->profile['post_count'] = $ultimatemember->query->count_posts($this->id);
155
- $this->profile['comment_count'] = $ultimatemember->query->count_comments($this->id);
156
-
157
  // add permissions
158
  $user_role = $this->get_role();
159
  $this->role_meta = $ultimatemember->query->role_data( $user_role );
150
  $this->profile[$k] = $v[0];
151
  }
152
 
 
 
 
 
153
  // add permissions
154
  $user_role = $this->get_role();
155
  $this->role_meta = $ultimatemember->query->role_data( $user_role );
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.0.88
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.0.89
7
  Author: Ultimate Member
8
  Author URI: http://ultimatemember.com/
9
  */
readme.txt CHANGED
@@ -7,7 +7,7 @@ Tags: access control, author, authors, author profile, comments, community, comm
7
  Requires at least: 4.1
8
  Tested up to: 4.1.1
9
 
10
- Stable Tag: 1.0.88
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
@@ -203,6 +203,10 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
203
 
204
  == Changelog ==
205
 
 
 
 
 
206
  = 1.0.88: March 18, 2015 =
207
 
208
  * Fixed: bug with viewing member profiles
7
  Requires at least: 4.1
8
  Tested up to: 4.1.1
9
 
10
+ Stable Tag: 1.0.89
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
203
 
204
  == Changelog ==
205
 
206
+ = 1.0.89: March 18, 2015 =
207
+
208
+ * Tweak: Major Performance Improvements (beta)
209
+
210
  = 1.0.88: March 18, 2015 =
211
 
212
  * Fixed: bug with viewing member profiles