WordPress.org

Making WordPress.org

Changeset 1010


Ignore:
Timestamp:
11/29/2014 07:58:22 PM (6 years ago)
Author:
johnjamesjacoby
Message:

BuddyPress.org: Remove autorole from codex. Update capability map to allow codex admins to moderate content & manage user access.

File:
1 edited

Legend:

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

    r442 r1010  
    366366
    367367        // Add some acitons
    368         add_action( 'init',       array( $this, 'autorole'    ), 11 );
    369368        add_action( 'admin_head', array( $this, 'unset_menus' ), 11 );
    370369
     
    377376
    378377    /**
    379      * WHen loading up a codex site, check the current users' role and make sure
     378     * When loading up a codex site, check the current users' role and make sure
    380379     * they are at least an editor.
    381380     *
     
    384383     * option to edit pages or link to wp-admin at all.
    385384     *
     385     * This method is not currently used. Codexes are manually moderated to prevent
     386     * automated spam attacks.
     387     *
    386388     * @author jjj
    387389     * @since February 6, 2012
     390     * @deprecated November 29, 2014
    388391     * @return Bail under certain conditions
    389392     */
     
    438441
    439442        // Should we bail
    440         if ( $this->bail() )
     443        if ( $this->bail() ) {
    441444            return $caps;
     445        }
    442446
    443447        // What cap are we switching
     
    448452            case 'delete_page'  :
    449453            case 'delete_codex_tags' :
    450                 if ( ! is_super_admin( $user_id ) ) {
    451                     $caps = array( 'do_not_allow' );
    452                 }
     454                $caps = array( 'do_not_allow' );
    453455                break;
    454456
     
    457459            case 'assign_codex_tags' :
    458460            case 'manage_codex_tags' :
    459                 if ( ! is_super_admin( $user_id ) ) {
    460                     $caps = array( 'editor' );
    461                 }
     461                $caps = array( 'editor' );
    462462                break;
    463463        }
     
    480480
    481481        // Should we bail
    482         if ( $this->bail() )
     482        if ( $this->bail() ) {
    483483            return;
     484        }
    484485
    485486        global $menu;
     
    530531
    531532        // Bail if user is not logged in
    532         if ( !is_user_logged_in() )
     533        if ( ! is_user_logged_in() ) {
    533534            return true;
    534 
    535         // Bail if you are a super admin,
    536         if ( is_super_admin() )
     535        }
     536
     537        // Bail if you are an admin,
     538        if ( current_user_can( 'manage_options' ) ) {
    537539            return true;
     540        }
    538541
    539542        return false;
Note: See TracChangeset for help on using the changeset viewer.