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
This commit is contained in:
parent
994033258e
commit
cbad0048a4
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue