Skip to:
Content

BuddyPress.org

Ticket #5374: 5374.not-network-activated.diff

File 5374.not-network-activated.diff, 2.2 KB (added by imath, 11 years ago)
  • bp-members/bp-members-admin.php

     
    102102                $this->css_url   = trailingslashit( $this->admin_url . 'css' ); // Admin CSS URL
    103103                $this->js_url    = trailingslashit( $this->admin_url . 'js'  ); // Admin CSS URL
    104104
     105                // Capability depends on config
     106                $this->capability = bp_core_do_network_admin() ? 'manage_network_options' : 'manage_options';
    105107                // The Edit Profile Screen id
    106108                $this->user_page = '';
    107109
     
    122124                $this->signups_page = '';
    123125                $this->users_url    = bp_get_admin_url( 'users.php' );
    124126                $this->users_screen = bp_core_do_network_admin() ? 'users-network' : 'users';
     127
     128                // Specific config: BuddyPress is not network activated
     129                $this->subsite_activated = (bool) is_multisite() && ! bp_is_network_activated();
     130
     131                if ( ! empty( $this->subsite_activated ) ) {
     132                        $this->capability = 'manage_network_options';
     133                }
    125134        }
    126135
    127136        /**
     
    151160
    152161                /** Signups **************************************************************/
    153162
    154                 if ( bp_get_signup_allowed() ) {
    155                         if ( ! is_multisite() && is_admin() ) {
     163                if ( bp_get_signup_allowed() && is_admin() ) {
     164                        if ( ! is_multisite() ) {
    156165                                add_action( 'pre_user_query', array( $this, 'remove_signups_from_user_query'),  10, 1 );
    157166                        }
    158167
    159                         // Reorganise the views navigation in users.php and signups page
    160                         add_filter( "views_{$this->users_screen}", array( $this, 'signup_filter_view' ),    10, 1 );
    161                         add_filter( 'set-screen-option',           array( $this, 'signup_screen_options' ), 10, 3 );
     168                        if ( current_user_can( $this->capability ) ) {
     169                                // Reorganise the views navigation in users.php and signups page
     170                                add_filter( "views_{$this->users_screen}", array( $this, 'signup_filter_view' ),    10, 1 );
     171                                add_filter( 'set-screen-option',           array( $this, 'signup_screen_options' ), 10, 3 );
     172                        }
    162173                }
    163174        }
    164175
     
    184195                $hooks['signups'] = $this->users_page = add_users_page(
    185196                        __( 'Manage Signups',  'buddypress' ),
    186197                        __( 'Manage Signups',  'buddypress' ),
    187                         'bp_moderate',
     198                        $this->capability,
    188199                        'bp-signups',
    189200                        array( &$this, 'signups_admin' )
    190201                );