id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses 13362,setup_userdata() should set the userdata globals even if the current user is 0,mdawaffe,,"== Problem == When calling {{{wp_set_current_user( 0 )}}}, {{{setup_userdata()}}} returns before clearing the userdata globals. Since we still rely on those globals in several places, returning before clearing has unexpected consequences. {{{setup_userdata()}}} should clear those globals if called for an empty user object. == Example == {{{ wp_set_current_user( 1 ); wp_set_current_user( 0 ); $post_id = wp_insert_post( 'post_author=0' ); $post = get_post( $post_id ); // This post has an author! }}} {{{wp_insert_post()}}} falls back to {{{$GLOBALS['user_ID']}}} when {{{post_author}}} is empty. This particular example is more likely to crop up now that we have awesome support for custome post types, but there are several places where we rely on these lame userdata globals. Marking as 3.0, but is it too late?",defect (bug),closed,normal,3.0,General,3.0,normal,fixed,has-patch,,