Skip to:
Content

BuddyPress.org

Changeset 8117


Ignore:
Timestamp:
03/12/2014 09:26:35 PM (10 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

Location:
trunk/bp-core
Files:
1 added
3 edited

Legend:

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

    r7827 r8117  
    7575 */
    7676function bp_core_modify_admin_menu_highlight() {
    77     global $plugin_page, $submenu_file;
     77    global $pagenow, $plugin_page, $submenu_file;
    7878
    7979    // This tweaks the Settings subnav menu to show only one BuddyPress menu item
    8080    if ( ! in_array( $plugin_page, array( 'bp-activity', 'bp-general-settings', ) ) )
    8181        $submenu_file = 'bp-components';
     82
     83    // Network Admin > Tools
     84    if ( in_array( $plugin_page, array( 'bp-tools', 'available-tools' ) ) ) {
     85        $submenu_file = $plugin_page;
     86    }
    8287}
    8388
     
    389394            'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ),
    390395            'name' => __( 'Settings', 'buddypress' )
    391         )
     396        ),
    392397    );
    393398
  • trunk/bp-core/admin/css/common.css

    r7754 r8117  
    9191    background-position: -61px -2px;
    9292}
     93
     94/* Tools */
     95#adminmenu .toplevel_page_network-tools div.wp-menu-image:before {
     96    content: "";
     97}
     98
    9399th.column-gid {
    94100    width: 60px;
  • 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.