Ensure we always have author info to check capabilities with. Fixes notice on Add new post page.

git-svn-id: https://develop.svn.wordpress.org/trunk@12053 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2009-10-18 12:06:39 +00:00
parent c61e6f6bbd
commit 94a2054bf5
1 changed files with 8 additions and 2 deletions

View File

@ -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...