Make WordPress Core

Changeset 12053


Ignore:
Timestamp:
10/18/2009 12:06:39 PM (16 years ago)
Author:
westi
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r12028 r12053  
    779779            return call_user_func_array( 'map_meta_cap', $args );
    780780        }
    781         $post_author_data = get_userdata( $post->post_author );
    782         //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />";
     781
     782        if ('' != $post->post_author) {
     783            $post_author_data = get_userdata( $post->post_author );
     784        } else {
     785            //No author set yet so default to current user for cap checks
     786            $post_author_data = $author_data;
     787        }
     788
    783789        // If the user is the author...
    784790        if ( $user_id == $post_author_data->ID ) {
Note: See TracChangeset for help on using the changeset viewer.