diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index 110c9f2aac..4a5ccec036 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -818,6 +818,14 @@ function map_meta_cap( $cap, $user_id ) { $page_author_data = get_userdata( $page->post_author ); //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "
"; // If the user is the author... + + if ('' != $page->post_author) { + $page_author_data = get_userdata( $page->post_author ); + } else { + //No author set yet so default to current user for cap checks + $page_author_data = $author_data; + } + if ( $user_id == $page_author_data->ID ) { // If the page is published... if ( $page->post_status == 'publish' ) { diff --git a/wp-includes/post.php b/wp-includes/post.php index 0f82c67977..626ebc45ce 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2279,8 +2279,8 @@ function get_all_page_ids() { */ function &get_page(&$page, $output = OBJECT, $filter = 'raw') { if ( empty($page) ) { - if ( isset( $GLOBALS['page'] ) && isset( $GLOBALS['page']->ID ) ) { - return get_post($GLOBALS['page'], $output, $filter); + if ( isset( $GLOBALS['post'] ) && isset( $GLOBALS['post']->ID ) ) { + return get_post($GLOBALS['post'], $output, $filter); } else { $page = null; return $page;