WordPress.org

Make WordPress Core

Changeset 33977


Ignore:
Timestamp:
09/09/2015 06:28:08 AM (5 years ago)
Author:
pento
Message:

Capabilities: Fall back to the edit_posts capability for orphaned comments.

Merge of the capabilities.php part of [33614] to the 3.7 branch.

Props pento, dd32.

Fixes #33154.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7/src/wp-includes/capabilities.php

    r33379 r33977  
    11851185            break;
    11861186        $post = get_post( $comment->comment_post_ID );
    1187         $caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
     1187
     1188        /*
     1189         * If the post doesn't exist, we have an orphaned comment.
     1190         * Fall back to the edit_posts capability, instead.
     1191         */
     1192        if ( $post ) {
     1193            $caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
     1194        } else {
     1195            $caps = map_meta_cap( 'edit_posts', $user_id );
     1196        }
    11881197        break;
    11891198    case 'unfiltered_upload':
Note: See TracChangeset for help on using the changeset viewer.