Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/12/2014 09:26:35 PM (11 years ago)
Author:
boonebgorges
Message:

Introduce BuddyPress Tools panel

Modeled on the bbPress panel, the BuddyPress Tools panel contains a number of
tools for repairing BuddyPress data. In this first iteration, the following
actions are supported:

  • Recalculate total_friend_count for each user
  • Recalculate total_group_count for each user
  • Recalculate total site members

On non-Multisite (or when BP is only activated on a single site), the menu
appears as Tools > BuddyPress. When BP is network-activated, we create a stub
Tools menu on the Network Admin to account for the fact that one is not
normally there. If WP ever introduces a menu like this, we can use it instead.

Fixes #5296

Props cmmarslender, boonebgorges, imath

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-admin.php

    r7952 r8117  
    119119        require( $this->admin_dir . 'bp-core-components.php' );
    120120        require( $this->admin_dir . 'bp-core-slugs.php'      );
     121        require( $this->admin_dir . 'bp-core-tools.php'      );
    121122    }
    122123
     
    153154        // Add a link to BuddyPress About page to the admin bar
    154155        add_action( 'admin_bar_menu', array( $this, 'admin_bar_about_link' ), 15 );
     156
     157        // Add a description of new BuddyPress tools in the available tools page
     158        add_action( 'tool_box', 'bp_core_admin_available_tools_intro' );
     159        add_action( 'bp_network_tool_box', 'bp_core_admin_available_tools_intro' );
    155160
    156161        /** Filters ***********************************************************/
     
    243248        );
    244249
     250        // For consistency with non-Multisite, we add a Tools menu in
     251        // the Network Admin as a home for our Tools panel
     252        if ( is_multisite() && bp_core_do_network_admin() ) {
     253            $tools_parent = 'network-tools';
     254
     255            $hooks[] = add_menu_page(
     256                __( 'Tools', 'buddypress' ),
     257                __( 'Tools', 'buddypress' ),
     258                'manage_network_options',
     259                $tools_parent,
     260                'bp_core_tools_top_level_item',
     261                '',
     262                24 // just above Settings
     263            );
     264
     265            $hooks[] = add_submenu_page(
     266                $tools_parent,
     267                __( 'Available Tools', 'buddypress' ),
     268                __( 'Available Tools', 'buddypress' ),
     269                'manage_network_options',
     270                'available-tools',
     271                'bp_core_admin_available_tools_page'
     272            );
     273        } else {
     274            $tools_parent = 'tools.php';
     275        }
     276
     277        $hooks[] = add_submenu_page(
     278            $tools_parent,
     279            __( 'BuddyPress Tools', 'buddypress' ),
     280            __( 'BuddyPress', 'buddypress' ),
     281            'manage_options',
     282            'bp-tools',
     283            'bp_core_admin_tools'
     284        );
     285
    245286        // Fudge the highlighted subnav item when on a BuddyPress admin page
    246287        foreach( $hooks as $hook ) {
     
    401442        remove_submenu_page( $this->settings_page, 'bp-page-settings' );
    402443        remove_submenu_page( $this->settings_page, 'bp-settings'      );
     444
     445        // Network Admin Tools
     446        remove_submenu_page( 'network-tools', 'network-tools' );
    403447
    404448        // About and Credits pages
Note: See TracChangeset for help on using the changeset viewer.