Ensure we always have author info to check capabilities with. Fixes notice on Add new post page.
git-svn-id: http://svn.automattic.com/wordpress/trunk@12053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
04638ecd6f
commit
5f9ac8a5fd
|
@ -778,8 +778,14 @@ function map_meta_cap( $cap, $user_id ) {
|
|||
$args = array_merge( array( 'delete_page', $user_id ), $args );
|
||||
return call_user_func_array( 'map_meta_cap', $args );
|
||||
}
|
||||
$post_author_data = get_userdata( $post->post_author );
|
||||
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />";
|
||||
|
||||
if ('' != $post->post_author) {
|
||||
$post_author_data = get_userdata( $post->post_author );
|
||||
} else {
|
||||
//No author set yet so default to current user for cap checks
|
||||
$post_author_data = $author_data;
|
||||
}
|
||||
|
||||
// If the user is the author...
|
||||
if ( $user_id == $post_author_data->ID ) {
|
||||
// If the post is published...
|
||||
|
|
Loading…
Reference in New Issue