Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/23/2012 06:18:39 AM (13 years ago)
Author:
johnjamesjacoby
Message:

First pass at adding user capabilities screen and action to settings component:

  • Add capabilities template
  • Unhook core spammer and deleted user actions and move to settings
  • Route admin bar links appropriately to new locations
  • Allow delete-account to be accessed by super admins in place of broken alerts
  • Improve general settings feedback
  • @todo - backpat post mortem
  • See #4038
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-settings/bp-settings-loader.php

    r5704 r5829  
    5050     *
    5151     * @since 1.5
    52      * @global obj $bp
    5352     */
    5453    function setup_globals() {
     
    6968    /**
    7069     * Setup BuddyBar navigation
    71      *
    72      * @global obj $bp
    7370     */
    7471    function setup_nav() {
    75         global $bp;
    7672
    7773        // Define local variable
     
    8480            'position'                => 100,
    8581            'show_for_displayed_user' => bp_core_can_edit_settings(),
    86             'screen_function'         => 'bp_core_screen_general_settings',
     82            'screen_function'         => 'bp_settings_screen_general',
    8783            'default_subnav_slug'     => 'general'
    8884        );
     
    104100            'parent_url'      => $settings_link,
    105101            'parent_slug'     => $this->slug,
    106             'screen_function' => 'bp_core_screen_general_settings',
     102            'screen_function' => 'bp_settings_screen_general',
    107103            'position'        => 10,
    108104            'user_has_access' => bp_core_can_edit_settings()
     
    115111            'parent_url'      => $settings_link,
    116112            'parent_slug'     => $this->slug,
    117             'screen_function' => 'bp_core_screen_notification_settings',
     113            'screen_function' => 'bp_settings_screen_notification',
    118114            'position'        => 20,
    119115            'user_has_access' => bp_core_can_edit_settings()
    120116        );
    121117
     118        // Add Spam Account nav item
     119        if ( bp_current_user_can( 'bp_moderate' ) ) {
     120            $sub_nav[] = array(
     121                'name'            => __( 'Capabilities', 'buddypress' ),
     122                'slug'            => 'capabilities',
     123                'parent_url'      => $settings_link,
     124                'parent_slug'     => $this->slug,
     125                'screen_function' => 'bp_settings_screen_capabilities',
     126                'position'        => 80,
     127                'user_has_access' => ! bp_is_my_profile()
     128            );
     129        }
     130
    122131        // Add Delete Account nav item
    123         if ( !bp_current_user_can( 'bp_moderate' ) && empty( $bp->site_options['bp-disable-account-deletion'] ) ) {
     132        if ( ! bp_disable_account_deletion() ) {
    124133            $sub_nav[] = array(
    125134                'name'            => __( 'Delete Account', 'buddypress' ),
     
    127136                'parent_url'      => $settings_link,
    128137                'parent_slug'     => $this->slug,
    129                 'screen_function' => 'bp_core_screen_delete_account',
     138                'screen_function' => 'bp_settings_screen_delete_account',
    130139                'position'        => 90,
    131                 'user_has_access' => bp_is_my_profile()
     140                'user_has_access' => bp_is_my_profile() || !is_super_admin( bp_displayed_user_id() )
    132141            );
    133142        }
Note: See TracChangeset for help on using the changeset viewer.