WordPress.org

Making WordPress.org


Ignore:
Timestamp:
11/28/17 19:27:14 (2 weeks ago)
Author:
coreymckrill
Message:

WordCamp Subroles: Fix WCPT fatal error in REST API

Ensure an authenticated user exists before checking capabilities.

Props iandunn

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wcorg-subroles.php

    r6182 r6187  
    136136        case 'edit_wordcamp' : 
    137137        case 'edit_others_wordcamps' : 
    138             if ( $current_user->has_cap( 'wordcamp_wrangle_wordcamps' ) ) { 
     138            if ( $current_user && $current_user->has_cap( 'wordcamp_wrangle_wordcamps' ) ) { 
    139139                $required_caps[] = 'wordcamp_wrangle_wordcamps'; 
    140140            } 
     
    150150 
    151151            if ( defined( 'WCPT_POST_TYPE_ID' ) && WCPT_POST_TYPE_ID === $post_type ) { 
    152                 if ( $current_user->has_cap( 'wordcamp_wrangle_wordcamps' ) ) { 
     152                if ( $current_user && $current_user->has_cap( 'wordcamp_wrangle_wordcamps' ) ) { 
    153153                    $required_caps[] = 'wordcamp_wrangle_wordcamps'; 
    154154                } 
Note: See TracChangeset for help on using the changeset viewer.