Making WordPress.org

Changeset 1011


Ignore:
Timestamp:
11/29/2014 08:47:00 PM (9 years ago)
Author:
johnjamesjacoby
Message:

BuddyPress.org: In codex, check administrator role instead of manage_options capability to avoid nested capability checks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/buddypress.org/public_html/wp-content/themes/bb-base/functions-codex.php

    r1010 r1011  
    394394
    395395        // Should we bail
    396         if ( $this->bail() )
     396        if ( $this->bail() ) {
    397397            return;
     398        }
    398399
    399400        global $current_user, $wp_roles;
    400401
    401402        // Sanity check on current_user
    402         if ( empty( $current_user ) )
     403        if ( empty( $current_user ) ) {
    403404            return;
     405        }
    404406
    405407        // Set some defaults
     
    414416
    415417        // Bail if role is already 'editor'
    416         if ( $user_role === $default_role )
     418        if ( $user_role === $default_role ) {
    417419            return;
     420        }
    418421
    419422        // Get editable roles
     
    535538        }
    536539
    537         // Bail if you are an admin,
    538         if ( current_user_can( 'manage_options' ) ) {
     540        // Bail if user is an admin
     541        if ( in_array( 'administrator', wp_get_current_user()->roles ) ) {
    539542            return true;
    540543        }
     
    544547}
    545548new Codex_Hacks();
     549
Note: See TracChangeset for help on using the changeset viewer.