Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/24/2011 05:26:18 AM (10 years ago)
Author:
johnjamesjacoby
Message:

This first pass at WP Admin Bar integration unhooks all WP core menus and replaces them with a full set of action based routines to handle the creation of admin bar menus at a BP component class level. This allows future external components to manipulate core menus or add their own with relative ease. Currently works off the BP_USE_WP_ADMIN_BAR constant, and should eventually phase out the BuddyBar in the long-term.

File:
1 edited

Legend:

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

    r3817 r4151  
    22
    33/**
    4  * Reserved for WordPress admin bar functions
     4 * BuddyPress Core Admin Bar
     5 *
     6 * Handles the core functions related to the WordPress Admin Bar
     7 *
     8 * @package BuddyPress
     9 * @subpackage Core
    510 */
    611
     12/**
     13 * Unhook the WordPress core menus. We will be adding our own to replace these.
     14 *
     15 * @todo Single blog/post/group/user/forum/activity menus
     16 * @todo Admin/moderator menus
     17 *
     18 * @since BuddyPress (r4151)
     19 *
     20 * @uses remove_action
     21 * @uses is_network_admin()
     22 * @uses is_user_admin()
     23 */
     24function bp_admin_bar_remove_wp_menus() {
     25    remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 );
     26    remove_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu',   20 );
     27    remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu',       30 );
     28    remove_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu',  80 );
     29
     30    if ( !is_network_admin() && !is_user_admin() ) {
     31        remove_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 );
     32        remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu',    50 );
     33        remove_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu',  60 );
     34    }
     35
     36    remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu',    70 );
     37}
     38if ( defined( 'BP_USE_WP_ADMIN_BAR' ) )
     39    add_action( 'bp_init', 'bp_admin_bar_remove_wp_menus', 2 );
     40
    741?>
Note: See TracChangeset for help on using the changeset viewer.