From 31dc7962bf8a04e6c7079966a0491103786eb803 Mon Sep 17 00:00:00 2001 From: ultimatemember Date: Tue, 27 Jan 2015 01:52:11 +0200 Subject: [PATCH] Version 1.0.27 --- admin/core/um-admin-access.php | 32 ++++++++++++++++++++++++++++++-- admin/core/um-admin-metabox.php | 27 ++++++++++++++++++++++++--- core/um-actions-wpadmin.php | 11 ++++++++++- core/um-filters-avatars.php | 3 +-- core/um-short-functions.php | 1 + index.php | 2 +- readme.txt | 11 ++++++++++- 7 files changed, 77 insertions(+), 10 deletions(-) diff --git a/admin/core/um-admin-access.php b/admin/core/um-admin-access.php index a93ee4ce..6534ea2f 100644 --- a/admin/core/um-admin-access.php +++ b/admin/core/um-admin-access.php @@ -60,7 +60,27 @@ class UM_Admin_Access { ***/ function load_metabox_form( $object, $box ) { global $ultimatemember, $post; - include_once um_path . 'admin/templates/access/settings.php'; + + $box['id'] = str_replace('um-admin-access-','', $box['id']); + + if ( $box['id'] == 'builder' ) { + $UM_Builder = new UM_Admin_Builder(); + $UM_Builder->form_id = get_the_ID(); + } + + preg_match('#\{.*?\}#s', $box['id'], $matches); + + if ( isset($matches[0]) ){ + $path = $matches[0]; + $box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] ); + } else { + $path = um_path; + } + + $path = str_replace('{','', $path ); + $path = str_replace('}','', $path ); + + include_once $path . 'admin/templates/access/'. $box['id'] . '.php'; wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_access_nonce' ); } @@ -72,7 +92,9 @@ class UM_Admin_Access { $types = get_post_types(); foreach($types as $post_type) { if ( $this->core_post_type( $post_type ) ) return; - add_meta_box('um-admin-access-control', __('Access Control'), array(&$this, 'load_metabox_form'), $post_type, 'side', 'default'); + add_meta_box('um-admin-access-settings', __('Access Control'), array(&$this, 'load_metabox_form'), $post_type, 'side', 'default'); + + do_action('um_admin_custom_access_metaboxes'); } } @@ -91,6 +113,12 @@ class UM_Admin_Access { if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id; // save + $multi_choice_keys = apply_filters('um_admin_multi_choice_keys', array() ); + if ( $multi_choice_keys ) { + foreach( $multi_choice_keys as $k ) { + delete_post_meta( $post_id, $k ); + } + } foreach( $_POST as $k => $v ) { if (strstr($k, '_um_')){ update_post_meta( $post_id, $k, $v); diff --git a/admin/core/um-admin-metabox.php b/admin/core/um-admin-metabox.php index 52993121..d21c9c6a 100644 --- a/admin/core/um-admin-metabox.php +++ b/admin/core/um-admin-metabox.php @@ -171,9 +171,28 @@ class UM_Admin_Metabox { *** @load a role metabox ***/ function load_metabox_role( $object, $box ) { - global $ultimatemember; + global $ultimatemember, $post; + $box['id'] = str_replace('um-admin-form-','', $box['id']); - include_once um_path . 'admin/templates/role/'. $box['id'] . '.php'; + + if ( $box['id'] == 'builder' ) { + $UM_Builder = new UM_Admin_Builder(); + $UM_Builder->form_id = get_the_ID(); + } + + preg_match('#\{.*?\}#s', $box['id'], $matches); + + if ( isset($matches[0]) ){ + $path = $matches[0]; + $box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] ); + } else { + $path = um_path; + } + + $path = str_replace('{','', $path ); + $path = str_replace('}','', $path ); + + include_once $path . 'admin/templates/role/'. $box['id'] . '.php'; wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_role_nonce' ); } @@ -181,7 +200,7 @@ class UM_Admin_Metabox { *** @load a form metabox ***/ function load_metabox_form( $object, $box ) { - global $ultimatemember; + global $ultimatemember, $post; $box['id'] = str_replace('um-admin-form-','', $box['id']); @@ -244,6 +263,8 @@ class UM_Admin_Metabox { add_meta_box('um-admin-form-logout', __('Logout Options'), array(&$this, 'load_metabox_role'), 'um_role', 'normal', 'default'); add_meta_box('um-admin-form-delete', __('Delete Options'), array(&$this, 'load_metabox_role'), 'um_role', 'normal', 'default'); + + do_action('um_admin_custom_role_metaboxes'); } diff --git a/core/um-actions-wpadmin.php b/core/um-actions-wpadmin.php index eb211912..8d5d98cb 100644 --- a/core/um-actions-wpadmin.php +++ b/core/um-actions-wpadmin.php @@ -63,7 +63,16 @@ if( !is_admin() && !um_user('can_access_wpadmin')) { return false; } else { + um_fetch_user( get_current_user_id() ); return true; } } - add_filter( 'show_admin_bar' , 'um_control_admin_bar'); \ No newline at end of file + add_filter( 'show_admin_bar' , 'um_control_admin_bar'); + + /*** + *** @fix permission for admin bar + ***/ + function um_force_admin_bar() { + um_reset_user(); + } + add_action( 'wp_footer', 'um_force_admin_bar' ); \ No newline at end of file diff --git a/core/um-filters-avatars.php b/core/um-filters-avatars.php index 3b9e4a02..4a9c9bd2 100644 --- a/core/um-filters-avatars.php +++ b/core/um-filters-avatars.php @@ -44,8 +44,7 @@ '?d='. $default . '&s=' . $size . '" class="gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="" />'; } - - um_reset_user(); + return $avatar; } \ No newline at end of file diff --git a/core/um-short-functions.php b/core/um-short-functions.php index 6041d3be..7f771918 100644 --- a/core/um-short-functions.php +++ b/core/um-short-functions.php @@ -63,6 +63,7 @@ *** @Capitalize first initial ***/ function um_cap_initials( $name ) { + if ( is_email( $name ) ) return $name; $name = str_replace('\' ', '\'', ucwords(str_replace('\'', '\' ', strtolower($name)))); return $name; } diff --git a/index.php b/index.php index fa4a6320..89785bee 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ Plugin Name: Ultimate Member Plugin URI: http://ultimatemember.com/ Description: Ultimate Member is a powerful community and membership plugin that allows you to create beautiful community and membership sites with WordPress -Version: 1.0.25 +Version: 1.0.27 Author: Ultimate Member Author URI: http://ultimatemember.com/ */ diff --git a/readme.txt b/readme.txt index 9dd747c4..a41a84e6 100644 --- a/readme.txt +++ b/readme.txt @@ -7,7 +7,7 @@ Tags: access control, community, communities, conditional fields, conditional lo Requires at least: 4.1 Tested up to: 4.1 -Stable Tag: 1.0.25 +Stable Tag: 1.0.27 License: GNU Version 2 or Any Later Version @@ -168,6 +168,15 @@ Yes. The plugin works fine with WordPress network / multisite now. In a recent u == Changelog == += 1.0.27: January 27, 2015 = + +* Fixed: WP admin bar issue with some plugins and themes +* Fixed: conflict with WP Recent Comments With Avatars plugin + += 1.0.26: January 26, 2015 = + +* Fixed: Important issue fix (update recommended) + = 1.0.25: January 26, 2015 = * New: addded support to use gravatars (optionally) If the user does not have a custom avatar