Making WordPress.org


Ignore:
Timestamp:
09/29/2020 02:34:43 AM (6 years ago)
Author:
dd32
Message:

Make: Trac Notifications: Don't attempt to allow logged out users to edit components.

This avoids a PHP Notice and just makes sense.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-components.php

    r9917 r10298  
    226226     */
    227227    public function map_meta_cap( $required_caps, $cap, $user_id, $context ) {
    228         if ( in_array( $cap, [ 'edit_post', 'publish_post', 'edit_others_posts' ], true ) ) {
     228        if ( $user_id && in_array( $cap, [ 'edit_post', 'publish_post', 'edit_others_posts' ], true ) ) {
    229229            if ( empty( $context[0] ) ) {
    230230                $context[0] = isset( $_POST['post_ID'] ) ? absint( $_POST['post_ID'] ) : 0;
Note: See TracChangeset for help on using the changeset viewer.