Update 1.0.89

This commit is contained in:
ultimatemember
2015-03-18 18:38:22 +02:00
parent 1653677136
commit 89722448cb
9 changed files with 70 additions and 45 deletions
+9 -3
View File
@@ -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), '<span style="color: #3dc3e5">' .__('Extensions', $this->slug) . '</span>', 'manage_options', $this->slug . '-extensions', array(&$this, 'admin_page') );
}
/***
*** @extension menu
***/
function extension_menu() {
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') );
}
/***
*** @load metabox stuff
***/
+2
View File
@@ -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);
}
+35
View File
@@ -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);
}
}
+9 -25
View File
@@ -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
***/
+4 -10
View File
@@ -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() ) {
-4
View File
@@ -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 );
+1 -1
View File
@@ -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/
*/
+9 -1
View File
@@ -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
+1 -1
View File
@@ -1829,7 +1829,7 @@ $this->sections[] = array(
'type' => 'switch',
'title' => __( 'Allow Tracking','ultimatemember' ),
'default' => 0,
'desc' => 'Help us improve Ultimate Members compatibility with other plugins and themes by allowing us to track non-sensitive data on your site. Click <a href="http://ultimatemember.com/tracking/">here</a> to see what data we track.',
'desc' => __( 'Help us improve Ultimate Members compatibility with other plugins and themes by allowing us to track non-sensitive data on your site. Click <a href="https://ultimatemember.com/tracking/" target="_blank">here</a> to see what data we track.', 'ultimatemember' ),
'on' => __('Allow tracking','ultimatemember'),
'off' => __('Do not allow','ultimatemember'),
),