Make WordPress Core

Ticket #16956: 16956.4.diff

File 16956.4.diff, 1.7 KB (added by imath, 11 years ago)
  • src/wp-admin/includes/class-wp-comments-list-table.php

    diff --git src/wp-admin/includes/class-wp-comments-list-table.php src/wp-admin/includes/class-wp-comments-list-table.php
    index 77733f1..4af0936 100644
    class WP_Comments_List_Table extends WP_List_Table { 
    552552                $this->comments_bubble( $post->ID, $pending_comments );
    553553                echo '</span> ';
    554554                $post_type_object = get_post_type_object( $post->post_type );
    555                 echo "<a href='" . get_permalink( $post->ID ) . "'>" . $post_type_object->labels->view_item . '</a>';
     555               
     556                if ( null !=  $post_type_object ) {
     557                        echo "<a href='" . get_permalink( $post->ID ) . "'>" . $post_type_object->labels->view_item . '</a>';
     558                }
     559               
    556560                echo '</div>';
    557561                if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
    558562                        echo $thumb;
  • src/wp-includes/capabilities.php

    diff --git src/wp-includes/capabilities.php src/wp-includes/capabilities.php
    index 45be4b5..3556711 100644
    function map_meta_cap( $cap, $user_id ) { 
    10761076                }
    10771077
    10781078                $post_type = get_post_type_object( $post->post_type );
     1079               
     1080                if ( is_null( $post_type ) ) {
     1081                        $caps[] = 'do_not_allow';
     1082                        break;
     1083                }
    10791084
    10801085                if ( ! $post_type->map_meta_cap ) {
    10811086                        $caps[] = $post_type->cap->$cap;
    function map_meta_cap( $cap, $user_id ) { 
    11221127                }
    11231128
    11241129                $post_type = get_post_type_object( $post->post_type );
     1130               
     1131                if ( is_null( $post_type ) ) {
     1132                        $caps[] = 'do_not_allow';
     1133                        break;
     1134                }
     1135               
     1136                if ( is_null( $post_type ) ) {
     1137                        $caps[] = 'do_not_allow';
     1138                        break;
     1139                }
    11251140
    11261141                if ( ! $post_type->map_meta_cap ) {
    11271142                        $caps[] = $post_type->cap->$cap;