diff --git a/admin/core/um-admin-dashboard.php b/admin/core/um-admin-dashboard.php
index 2090a2d8..170e9242 100644
--- a/admin/core/um-admin-dashboard.php
+++ b/admin/core/um-admin-dashboard.php
@@ -10,7 +10,8 @@ class UM_Admin_Dashboard {
$this->about_tabs['start'] = 'Getting Started';
add_action('admin_menu', array(&$this, 'primary_admin_menu'), 0);
- add_action('admin_menu', array(&$this, 'secondary_menu_items'), 1000);
+ add_action('admin_menu', array(&$this, 'secondary_menu_items'), 1000);
+ add_action('admin_menu', array(&$this, 'extension_menu'), 9999);
}
@@ -43,11 +44,16 @@ class UM_Admin_Dashboard {
}
do_action('um_extend_admin_menu');
-
- add_submenu_page( $this->slug, __('Extensions', $this->slug), '' .__('Extensions', $this->slug) . '', 'manage_options', $this->slug . '-extensions', array(&$this, 'admin_page') );
}
+ /***
+ *** @extension menu
+ ***/
+ function extension_menu() {
+ add_submenu_page( $this->slug, __('Extensions', $this->slug), '' .__('Extensions', $this->slug) . '', 'manage_options', $this->slug . '-extensions', array(&$this, 'admin_page') );
+ }
+
/***
*** @load metabox stuff
***/
diff --git a/admin/core/um-admin-metabox.php b/admin/core/um-admin-metabox.php
index dc529a4a..0324e099 100644
--- a/admin/core/um-admin-metabox.php
+++ b/admin/core/um-admin-metabox.php
@@ -380,6 +380,8 @@ class UM_Admin_Metabox {
update_post_meta( $post_id, $k, $v);
}
}
+
+ do_action('um_admin_after_editing_role', $post_id, $post);
}
diff --git a/core/um-cache.php b/core/um-cache.php
index 3f4b085c..d7419c05 100644
--- a/core/um-cache.php
+++ b/core/um-cache.php
@@ -6,8 +6,15 @@ class UM_Cache {
add_action( 'init', array(&$this, 'do_not_cache' ) );
+ add_action('um_admin_after_editing_role', array(&$this, 'delete_role_cache'), 10, 2 );
+
+ $this->role_data = get_option('um_cache_role_data');
+
}
+ /***
+ *** @needed for some cache plugins
+ ***/
function do_not_cache() {
if ( um_is_core_uri() ) {
@@ -15,5 +22,33 @@ class UM_Cache {
}
}
+
+ /***
+ *** @clear cached role data
+ ***/
+ function delete_role_cache( $post_id, $post ) {
+ $role_slug = $post->post_name;
+ if ( isset( $this->role_data[ $role_slug ] ) ) {
+ unset( $this->role_data[ $role_slug ] );
+ update_option('um_cache_role_data', $this->role_data);
+ }
+ }
+
+ /***
+ *** @get cached role data
+ ***/
+ function role_data( $role_slug ) {
+ if ( isset( $this->role_data[ $role_slug ] ) )
+ return $this->role_data[ $role_slug ];
+ return null;
+ }
+
+ /***
+ *** @set role data cache
+ ***/
+ function set_role_data( $role_slug, $array ) {
+ $this->role_data[ $role_slug ] = $array;
+ update_option('um_cache_role_data', $this->role_data);
+ }
}
\ No newline at end of file
diff --git a/core/um-query.php b/core/um-query.php
index 2b7a277b..893133a0 100644
--- a/core/um-query.php
+++ b/core/um-query.php
@@ -183,6 +183,11 @@ class UM_Query {
***/
function role_data( $role_slug ) {
global $wpdb, $ultimatemember;
+
+ // get cache
+ if ( $ultimatemember->cache->role_data( $role_slug ) ) {
+ return $ultimatemember->cache->role_data( $role_slug );
+ }
if ($role_slug == 'admin' || $role_slug == 'member'){
$try = $this->find_post_id('um_role','_um_core',$role_slug);
@@ -212,6 +217,10 @@ class UM_Query {
$array = $ultimatemember->setup->get_initial_permissions( $role_slug );
}
+
+ // set cache
+ $ultimatemember->cache->set_role_data( $role_slug, $array );
+
return $array;
}
@@ -246,31 +255,6 @@ class UM_Query {
return $array;
}
- /***
- *** @Counts all user posts
- ***/
- function count_posts($user_id){
- $args = array(
- 'author' => $user_id,
- 'post_status' => array('publish'),
- 'post_type' => 'any'
- );
- $posts = new WP_Query( $args );
- $post_count = $posts->found_posts;
- return $post_count;
- }
-
- /***
- *** @Count comments by user
- ***/
- function count_comments( $user_id ) {
- $args = array(
- 'user_id' => $user_id
- );
- $comments = get_comments( $args );
- return count($comments);
- }
-
/***
*** @Capture selected value
***/
diff --git a/core/um-short-functions.php b/core/um-short-functions.php
index 73816ec6..044b52de 100644
--- a/core/um-short-functions.php
+++ b/core/um-short-functions.php
@@ -391,14 +391,8 @@ function um_profile_id() {
*** @get a user's display name
***/
function um_get_display_name( $user_id ) {
- global $ultimatemember;
-
- $ultimatemember->user->reset( true );
- $ultimatemember->user->set( $user_id );
- $cached = um_user('display_name');
- $ultimatemember->user->reset();
- return $cached;
-
+ $user = get_userdata( $user_id );
+ return $user->display_name;
}
/***
@@ -542,8 +536,8 @@ function um_reset_user() {
function um_can_view_profile( $user_id ){
global $ultimatemember;
- if ( !um_current_user_can('edit', $user_id ) && !$ultimatemember->user->is_approved( $user_id ) ) {
- return false;
+ if ( um_current_user_can('edit', $user_id ) ) {
+ return true;
}
if ( !is_user_logged_in() ) {
diff --git a/core/um-user.php b/core/um-user.php
index 824ab7ba..4b198d23 100644
--- a/core/um-user.php
+++ b/core/um-user.php
@@ -150,10 +150,6 @@ class UM_User {
$this->profile[$k] = $v[0];
}
- // add user stuff
- $this->profile['post_count'] = $ultimatemember->query->count_posts($this->id);
- $this->profile['comment_count'] = $ultimatemember->query->count_comments($this->id);
-
// add permissions
$user_role = $this->get_role();
$this->role_meta = $ultimatemember->query->role_data( $user_role );
diff --git a/index.php b/index.php
index 52a05eb2..5dbf3946 100644
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
Plugin Name: Ultimate Member
Plugin URI: http://ultimatemember.com/
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
-Version: 1.0.87
+Version: 1.0.89
Author: Ultimate Member
Author URI: http://ultimatemember.com/
*/
diff --git a/readme.txt b/readme.txt
index cfb88f08..2ac40aee 100644
--- a/readme.txt
+++ b/readme.txt
@@ -7,7 +7,7 @@ Tags: access control, author, authors, author profile, comments, community, comm
Requires at least: 4.1
Tested up to: 4.1.1
-Stable Tag: 1.0.87
+Stable Tag: 1.0.89
License: GNU Version 2 or Any Later Version
@@ -203,6 +203,14 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
== Changelog ==
+= 1.0.89: March 18, 2015 =
+
+* Tweak: Major Performance Improvements (beta)
+
+= 1.0.88: March 18, 2015 =
+
+* Fixed: bug with viewing member profiles
+
= 1.0.87: March 17, 2015 =
* Tweak: profile edit form tweaked to be processed for profile edit only. allows you to have custom (not nested) valid forms in other profile tabs
diff --git a/um-config.php b/um-config.php
index 9e7c7b15..648e2e68 100644
--- a/um-config.php
+++ b/um-config.php
@@ -1829,7 +1829,7 @@ $this->sections[] = array(
'type' => 'switch',
'title' => __( 'Allow Tracking','ultimatemember' ),
'default' => 0,
- 'desc' => 'Help us improve Ultimate Member’s compatibility with other plugins and themes by allowing us to track non-sensitive data on your site. Click here to see what data we track.',
+ 'desc' => __( 'Help us improve Ultimate Member’s compatibility with other plugins and themes by allowing us to track non-sensitive data on your site. Click here to see what data we track.', 'ultimatemember' ),
'on' => __('Allow tracking','ultimatemember'),
'off' => __('Do not allow','ultimatemember'),
),