From 3749745c3d24493bd3e24e9612802aef08550f8b Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 30 Aug 2013 04:00:06 +0000 Subject: [PATCH] Don't set up $post_author_data in map_meta_cap() as we don't need it. props duck_. fixes #25177. git-svn-id: https://develop.svn.wordpress.org/trunk@25177 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/capabilities.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php index c3bb58f627..1884cdc785 100644 --- a/src/wp-includes/capabilities.php +++ b/src/wp-includes/capabilities.php @@ -1039,10 +1039,8 @@ function map_meta_cap( $cap, $user_id ) { if ( ! $post_author_id ) $post_author_id = $user_id; - $post_author_data = $post_author_id == get_current_user_id() ? wp_get_current_user() : get_userdata( $post_author_id ); - // If the user is the author... - if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) { + if ( $user_id == $post_author_id ) { // If the post is published... if ( 'publish' == $post->post_status ) { $caps[] = $post_type->cap->delete_published_posts; @@ -1089,10 +1087,8 @@ function map_meta_cap( $cap, $user_id ) { if ( ! $post_author_id ) $post_author_id = $user_id; - $post_author_data = $post_author_id == get_current_user_id() ? wp_get_current_user() : get_userdata( $post_author_id ); - // If the user is the author... - if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) { + if ( $user_id == $post_author_id ) { // If the post is published... if ( 'publish' == $post->post_status ) { $caps[] = $post_type->cap->edit_published_posts; @@ -1143,9 +1139,7 @@ function map_meta_cap( $cap, $user_id ) { if ( ! $post_author_id ) $post_author_id = $user_id; - $post_author_data = $post_author_id == get_current_user_id() ? wp_get_current_user() : get_userdata( $post_author_id ); - - if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) + if ( $user_id == $post_author_id ) $caps[] = $post_type->cap->read; elseif ( $status_obj->private ) $caps[] = $post_type->cap->read_private_posts;