From cbad0048a4adbc6f5b0c35e85247f1e176cd23a5 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 30 Aug 2013 04:01:08 +0000 Subject: [PATCH] Don't set up $post_author_data in map_meta_cap() as we don't need it. props duck_. fixes #25177. Built from https://develop.svn.wordpress.org/trunk@25177 git-svn-id: http://core.svn.wordpress.org/trunk@25150 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/capabilities.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index c3bb58f627..1884cdc785 100644 --- a/wp-includes/capabilities.php +++ b/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;