WordPress.org

Make WordPress Core

Ticket #10758: 10758-wp-includes-authortemplateandcapabilties.patch

File 10758-wp-includes-authortemplateandcapabilties.patch, 1.2 KB (added by hakre, 6 years ago)

Testrun with 2.8.4 revealed unchecked conditions.

  • wp-includes/author-template.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    2222 */ 
    2323function get_the_author($deprecated = '') { 
    2424        global $authordata; 
    25         return apply_filters('the_author', $authordata->display_name); 
     25        return apply_filters('the_author', is_object($authordata) ? $authordata->display_name : null); 
    2626} 
    2727 
    2828/** 
  • wp-includes/capabilities.php

     
    833833                $post_author_data = get_userdata( $post->post_author ); 
    834834                //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />"; 
    835835                // If the user is the author... 
    836                 if ( $user_id == $post_author_data->ID ) { 
     836                if ( is_object($post_author_data) && $user_id == $post_author_data->ID ) { 
    837837                        // If the post is published... 
    838838                        if ( 'publish' == $post->post_status ) { 
    839839                                $caps[] = 'edit_published_posts';