示例#1
0
 public function admin_bar_menu()
 {
     global $wp_admin_bar;
     $wp_admin_bar->add_menu(array('id' => 'gdbb-toolbar', 'title' => __("Forums", "gd-bbpress-tools"), 'href' => get_post_type_archive_link('forum'), 'meta' => array('class' => 'icon-gdbb-toolbar')));
     $wp_admin_bar->add_group(array('parent' => 'gdbb-toolbar', 'id' => 'gdbb-toolbar-public'));
     $query = $forums_query = array('post_parent' => 0, 'post_status' => 'publish', 'posts_per_page' => 20, 'orderby' => 'menu_order', 'order' => 'ASC');
     $forums = bbp_get_forums_for_current_user($query);
     if (is_array($forums) && count($forums) > 0) {
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-public', 'id' => 'gdbb-toolbar-forums', 'title' => __("Forums", "gd-bbpress-tools"), 'href' => bbp_get_forums_url()));
         foreach ($forums as $forum) {
             $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-forums', 'id' => 'gdbb-toolbar-forums-' . $forum->ID, 'title' => apply_filters('the_title', $forum->post_title, $forum->ID), 'href' => get_permalink($forum->ID)));
         }
     }
     $views = bbp_get_views();
     if (is_array($views) && count($views) > 0) {
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-public', 'id' => 'gdbb-toolbar-views', 'title' => __("Views", "gd-bbpress-tools"), 'href' => bbp_get_forums_url()));
         foreach ($views as $view => $args) {
             $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-views', 'id' => 'gdbb-toolbar-views-' . $view, 'title' => bbp_get_view_title($view), 'href' => bbp_get_view_url($view)));
         }
     }
     if (current_user_can(GDBBPRESSTOOLS_CAP)) {
         $wp_admin_bar->add_group(array('parent' => 'gdbb-toolbar', 'id' => 'gdbb-toolbar-admin'));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-admin', 'id' => 'gdbb-toolbar-new', 'title' => __("New", "gd-bbpress-tools"), 'href' => ''));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-new', 'id' => 'gdbb-toolbar-new-forum', 'title' => __("Forum", "gd-bbpress-tools"), 'href' => admin_url('post-new.php?post_type=forum')));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-new', 'id' => 'gdbb-toolbar-new-topic', 'title' => __("Topic", "gd-bbpress-tools"), 'href' => admin_url('post-new.php?post_type=topic')));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-new', 'id' => 'gdbb-toolbar-new-reply', 'title' => __("Reply", "gd-bbpress-tools"), 'href' => admin_url('post-new.php?post_type=reply')));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-admin', 'id' => 'gdbb-toolbar-edit', 'title' => __("Edit", "gd-bbpress-tools"), 'href' => ''));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-edit', 'id' => 'gdbb-toolbar-edit-forums', 'title' => __("Forums", "gd-bbpress-tools"), 'href' => admin_url('edit.php?post_type=forum')));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-edit', 'id' => 'gdbb-toolbar-edit-topics', 'title' => __("Topics", "gd-bbpress-tools"), 'href' => admin_url('edit.php?post_type=topic')));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-edit', 'id' => 'gdbb-toolbar-edit-replies', 'title' => __("Replies", "gd-bbpress-tools"), 'href' => admin_url('edit.php?post_type=reply')));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-admin', 'id' => 'gdbb-toolbar-settings', 'title' => __("Settings", "gd-bbpress-tools"), 'href' => ''));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-settings', 'id' => 'gdbb-toolbar-settings-main', 'title' => __("bbPress Settings", "gd-bbpress-tools"), 'href' => admin_url('options-general.php?page=bbpress')));
         $wp_admin_bar->add_group(array('parent' => 'gdbb-toolbar-settings', 'id' => 'gdbb-toolbar-settings-third'));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-settings-third', 'id' => 'gdbb-toolbar-settings-third-tools', 'title' => __("GD bbPress Tools", "gd-bbpress-tools"), 'href' => admin_url('edit.php?post_type=forum&page=gdbbpress_tools')));
         if (defined('GDBBPRESSATTACHMENTS_INSTALLED')) {
             $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-settings-third', 'id' => 'gdbb-toolbar-settings-third-attachments', 'title' => __("GD bbPress Attchments", "gd-bbpress-tools"), 'href' => admin_url('edit.php?post_type=forum&page=gdbbpress_attachments')));
         }
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-admin', 'id' => 'gdbb-toolbar-tools', 'title' => __("Tools", "gd-bbpress-tools"), 'href' => ''));
         $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-tools', 'id' => 'gdbb-toolbar-tools-recount', 'title' => __("Recount", "gd-bbpress-tools"), 'href' => admin_url('tools.php?page=bbp-recount')));
     }
     $wp_admin_bar->add_group(array('parent' => 'gdbb-toolbar', 'id' => 'gdbb-toolbar-info', 'meta' => array('class' => 'ab-sub-secondary')));
     $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-info', 'id' => 'gdbb-toolbar-info-links', 'title' => __("Information", "gd-bbpress-tools")));
     $wp_admin_bar->add_group(array('parent' => 'gdbb-toolbar-info-links', 'id' => 'gdbb-toolbar-info-links-bbp', 'meta' => array('class' => 'ab-sub-secondary')));
     $wp_admin_bar->add_group(array('parent' => 'gdbb-toolbar-info-links', 'id' => 'gdbb-toolbar-info-links-d4p', 'meta' => array('class' => 'ab-sub-secondary')));
     $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-info-links-bbp', 'id' => 'gdbb-toolbar-bbp-home', 'title' => __("bbPress Homepage", "gd-bbpress-tools"), 'href' => 'http://bbpress.org/', 'meta' => array('target' => '_blank')));
     $wp_admin_bar->add_menu(array('parent' => 'gdbb-toolbar-info-links-d4p', 'id' => 'gdbb-toolbar-d4p-home', 'title' => __("Dev4Press Homepage", "gd-bbpress-tools"), 'href' => 'http://www.dev4press.com/', 'meta' => array('target' => '_blank')));
 }
/**
 * Add new menu items to the WordPress Toolbar / Admin Bar.
 * 
 * @since 1.0
 * @version 1.3
 *
 * @global mixed $wp_admin_bar 
 */
function ddw_bbpress_aba_admin_bar_menu()
{
    global $wp_admin_bar;
    /**
     * Allows for filtering the general user role/capability to see main & sub-level items
     *
     * Default role: 'moderate' (set by bbPress 2.x itself!)
     *
     * @since 1.5
     */
    $bbpaba_filter_capability = apply_filters('bbpaba_filter_capability_all', 'moderate');
    /**
     * Required bbPress/ WordPress cabability to display new admin bar entry
     * Only showing items if toolbar / admin bar is activated and user is logged in!
     *
     * @since 1.0
     * @version 1.1
     */
    if (!is_user_logged_in() || !is_admin_bar_showing() || !current_user_can($bbpaba_filter_capability) || !BBPABA_DISPLAY) {
        return;
    }
    /** Set unique prefix */
    $prefix = 'ddw-bbpress-';
    /** Create parent menu item references/prefixes */
    $bbpressbar = $prefix . 'admin-bar';
    // root level
    $bbpsupport = $prefix . 'bbpsupport';
    // sub level: bbp support
    $bbpdocumentation = $prefix . 'bbpdocumentation';
    // sub level: bbp documentation
    $bbpknowledgebase = $prefix . 'bbpknowledgebase';
    // sub level: bbp knowledgebase
    $bbpsites = $prefix . 'bbpsites';
    // sub level: bbp sites
    $bbpsettings = $prefix . 'bbpsettings';
    // sub level: bbp settings
    $forums = $prefix . 'forums';
    // sub level: forums
    $forumsfrontbase = $prefix . 'forumsfrontbase';
    // third level: forums frontend view
    $f_gdtools = $prefix . 'f_gdtools';
    // third level plugin extension: gd bbpress tools
    $f_gdtoolbox = $prefix . 'f_gdtoolbox';
    // third level plugin extension: gd bbpress toolbox
    $topics = $prefix . 'topics';
    // sub level: topics
    $replies = $prefix . 'replies';
    // sub level: replies
    $users = $prefix . 'users';
    // sub level: users
    $userswangguard = $prefix . 'userswangguard';
    // third level plugin extension: wangguard
    $extensions = $prefix . 'extensions';
    // sub level: support
    $extgdtools = $prefix . 'extgdtools';
    // third level plugin extension: gd bbpress tools
    $extgdtoolbox = $prefix . 'extgdtoolbox';
    // third level plugin extension: gd bbpress toolbox
    $extwangguard = $prefix . 'extwangguard';
    // third level plugin extension: wangguard
    $extcptprivacy = $prefix . 'extcptprivacy';
    // third level plugin extension: custom post type privacy
    $extbbpconvert = $prefix . 'extbbpconvert';
    // third level plugin extension: bbconverter
    $exts2member = $prefix . 'exts2member';
    // third level plugin extension: s2member
    $bbpgroup = $prefix . 'bbpgroup';
    // sub level: bbp group (resources)
    /** Make the "bbPress" name filterable within menu items */
    $bbpaba_bbpress_name = apply_filters('bbpaba_filter_bbpress_name', __('bbPress', 'bbpaba'));
    /** Make the "bbPress" name's tooltip filterable within menu items */
    $bbpaba_bbpress_name_tooltip = apply_filters('bbpaba_filter_bbpress_name_tooltip', _x('bbPress', 'Translators: For the tooltip', 'bbpaba'));
    /**
     * Check for WordPress version to add parent ids for resource links group
     * Check against WP 3.3+ only function "wp_editor" - if true use "$bbpgroup" as parent (WP 3.3+ style)
     * otherwise use "$bbpressbar" as parent (WP 3.1/3.2 style)
     *
     * @since 1.4
     *
     * @param $bbpgroup_check_item
     */
    if (function_exists('wp_editor')) {
        $bbpgroup_check_item = $bbpgroup;
    } else {
        $bbpgroup_check_item = $bbpressbar;
    }
    /** Display these items also when bbPress plugin is not installed */
    if (BBPABA_RESOURCES_DISPLAY) {
        /** Include plugin file with resources links */
        require_once BBPABA_PLUGIN_DIR . '/includes/bbpaba-resources.php';
    }
    // end-if constant check for displaying resources
    /** Display the following links only for these locales: de_DE, de_AT, de_CH, de_LU */
    if (BBPABA_DE_DISPLAY && (get_locale() == 'de_DE' || get_locale() == 'de_AT' || get_locale() == 'de_CH' || get_locale() == 'de_LU')) {
        /** German public community support forum */
        $menu_items['bbp-forum-de'] = array('parent' => $bbpgroup_check_item, 'title' => __('German Support Forum', 'bbpaba'), 'href' => 'http://forum.wpde.org/bbpress/', 'meta' => array('title' => _x('Public German Community Support Forum', 'Translators: For the tooltip', 'bbpaba')));
        /** German language packs */
        $menu_items['bbp-languages-de'] = array('parent' => $bbpgroup_check_item, 'title' => __('German language files', 'bbpaba'), 'href' => 'http://deckerweb.de/material/sprachdateien/bbpress-forum/', 'meta' => array('title' => _x('German language files for bbPress 2.x plus some extensions', 'Translators: For the tooltip', 'bbpaba')));
    }
    // end-if german locales
    /** Show these items only if bbPress plugin is actually installed */
    if (class_exists('bbPress')) {
        /** Main settings link */
        $bbp_aurl_main = admin_url('options-general.php?page=bbpress');
        /** Main settings section */
        if (current_user_can('manage_options')) {
            $menu_items['bbpsettings'] = array('parent' => $bbpressbar, 'title' => esc_attr__($bbpaba_bbpress_name) . ' ' . __('Main Settings', 'bbpaba'), 'href' => admin_url('options-general.php?page=bbpress'), 'meta' => array('target' => '', 'title' => esc_attr__($bbpaba_bbpress_name_tooltip) . ' ' . _x('Main Settings', 'Translators: For the tooltip', 'bbpaba')));
        }
        // end-if cap check
        /** Settings: Widgets & Menus */
        if (current_user_can('edit_theme_options')) {
            $menu_items['s-widgets'] = array('parent' => $bbpsettings, 'title' => esc_attr__($bbpaba_bbpress_name) . ' ' . __('Widgets', 'bbpaba'), 'href' => admin_url('widgets.php'), 'meta' => array('target' => '', 'title' => esc_attr__($bbpaba_bbpress_name_tooltip) . ' ' . __('Widgets', 'bbpaba')));
            $menu_items['s-menus'] = array('parent' => $bbpsettings, 'title' => esc_attr__($bbpaba_bbpress_name) . ' ' . __('Menus', 'bbpaba'), 'href' => admin_url('nav-menus.php'), 'meta' => array('target' => '', 'title' => esc_attr__($bbpaba_bbpress_name_tooltip) . ' ' . __('Menus', 'bbpaba')));
        }
        // end-if cap check
        /** Settings: Repair/Import/Reset Forums (former: Recount) */
        if (is_super_admin() && current_user_can('manage_options')) {
            /** Set "Repair" admin URL */
            if (function_exists('bbp_current_user_can_see')) {
                $bbp_aurl_repair = admin_url('tools.php?page=bbp-repair');
            } else {
                $bbp_aurl_repair = admin_url('tools.php?page=bbp-recount');
            }
            $menu_items['s-repairforums'] = array('parent' => $bbpsettings, 'title' => __('Repair Forums', 'bbpaba'), 'href' => $bbp_aurl_repair, 'meta' => array('target' => '', 'title' => _x('Repair Forum Relationships for Topics, Replies, Voices etc.', 'Translators: For the tooltip', 'bbpaba')));
        }
        // end-if cap check
        /** Settings: Update Forums in Multisite - only for super admins */
        if (current_user_can('manage_network')) {
            $menu_items['s-msupdate'] = array('parent' => $bbpsettings, 'title' => __('Update Forums', 'bbpaba'), 'href' => network_admin_url('update-core.php?page=bbpress-update'), 'meta' => array('target' => '', 'title' => sprintf(_x('Update all %s Forums in Multisite', 'Translators: For the tooltip', 'bbpaba'), esc_attr__($bbpaba_bbpress_name_tooltip))));
        }
        // end-if multisite check
        /** Settings: Import Forums (Converter) */
        if (class_exists('BBP_Converter') && current_user_can('manage_options') && (function_exists('bbp_current_user_can_see') && bbp_current_user_can_see('bbp_tools_import_page'))) {
            $menu_items['s-importforums'] = array('parent' => $bbpsettings, 'title' => __('Import Forums', 'bbpaba'), 'href' => admin_url('tools.php?page=bbp-converter'), 'meta' => array('target' => '', 'title' => sprintf(_x('bbPress Converter: Convert other forum systems to %s', 'Translators: For the tooltip', 'bbpaba'), esc_attr__($bbpaba_bbpress_name_tooltip))));
        }
        // end-if cap check
        /** Settings: Reset Forums */
        if (current_user_can('manage_options') && (function_exists('bbp_current_user_can_see') && bbp_current_user_can_see('bbp_tools_reset_page'))) {
            $menu_items['s-resetforums'] = array('parent' => $bbpsettings, 'title' => __('Reset Forums', 'bbpaba'), 'href' => admin_url('tools.php?page=bbp-reset'), 'meta' => array('target' => '', 'title' => sprintf(_x('Reset Forums to brand new %s install', 'Translators: For the tooltip', 'bbpaba'), esc_attr__($bbpaba_bbpress_name_tooltip))));
        }
        // end-if cap check
        /** Forums section */
        if (current_user_can('publish_forums') || current_user_can('edit_forum')) {
            $menu_items['forums'] = array('parent' => $bbpressbar, 'title' => __('Forums', 'bbpaba'), 'href' => admin_url('edit.php?post_type=forum'), 'meta' => array('target' => '', 'title' => __('Forums', 'bbpaba')));
            /** Forums helper code */
            $bbpaba_query = $bbpaba_forums_query = array('post_parent' => 0, 'post_status' => 'publish', 'posts_per_page' => 20, 'orderby' => 'menu_order', 'order' => 'ASC');
            $bbpaba_forums = bbp_get_forums_for_current_user($bbpaba_query);
            /** If Forums are available, display their links */
            if (is_array($bbpaba_forums) && count($bbpaba_forums) > 0) {
                /** Forums Front Base = Forums Archive */
                $menu_items['forumsfrontbase'] = array('parent' => $forums, 'title' => __('View Forums', 'bbpaba'), 'href' => get_post_type_archive_link('forum'), 'meta' => array('target' => '', 'title' => __('View Forums', 'bbpaba')));
                /** Dynamically add all active Forums */
                foreach ($bbpaba_forums as $bbpaba_forum) {
                    $menu_items['forums-frontend-' . $bbpaba_forum->ID] = array('parent' => $forumsfrontbase, 'title' => apply_filters('the_title', $bbpaba_forum->post_title, $bbpaba_forum->ID), 'href' => esc_url_raw(get_permalink($bbpaba_forum->ID)), 'meta' => array('target' => '', 'title' => _x('View Forum', 'Translators: For the tooltip', 'bbpaba') . ': ' . apply_filters('the_title', $bbpaba_forum->post_title, $bbpaba_forum->ID)));
                }
                // end foreach
            }
            // end-if available forums check
            /**
             * Action Hook 'bbpaba_custom_forum_items'
             * allows for hooking other custom forum items in
             *
             * @since 1.5
             */
            do_action('bbpaba_custom_forum_items');
            /** Add new forum */
            $menu_items['f-add-forum'] = array('parent' => $forums, 'title' => __('Add new Forum', 'bbpaba'), 'href' => admin_url('post-new.php?post_type=forum'), 'meta' => array('target' => '', 'title' => __('Add new Forum', 'bbpaba')));
        }
        // end-if cap check / forum section
        /** Topics section */
        if (current_user_can('publish_topics') || current_user_can('edit_topic')) {
            $menu_items['topics'] = array('parent' => $bbpressbar, 'title' => __('Topics', 'bbpaba'), 'href' => admin_url('edit.php?post_type=topic'), 'meta' => array('target' => '', 'title' => __('Topics', 'bbpaba')));
            $menu_items['t-add-topic'] = array('parent' => $topics, 'title' => __('Add new Topic', 'bbpaba'), 'href' => admin_url('post-new.php?post_type=topic'), 'meta' => array('target' => '', 'title' => __('Add new Topic', 'bbpaba')));
            $menu_items['t-topic-tags'] = array('parent' => $topics, 'title' => __('Topic Tags', 'bbpaba'), 'href' => admin_url('edit-tags.php?taxonomy=topic-tag&post_type=topic'), 'meta' => array('target' => '', 'title' => __('Topic Tags', 'bbpaba')));
        }
        // end-if cap check
        /** Replies section */
        if (current_user_can('publish_replies') || current_user_can('edit_reply')) {
            $menu_items['replies'] = array('parent' => $bbpressbar, 'title' => __('Replies', 'bbpaba'), 'href' => admin_url('edit.php?post_type=reply'), 'meta' => array('target' => '', 'title' => _x('Replies', 'Translators: For the tooltip', 'bbpaba')));
            $menu_items['r-add-reply'] = array('parent' => $replies, 'title' => __('Add new Reply', 'bbpaba'), 'href' => admin_url('post-new.php?post_type=reply'), 'meta' => array('target' => '', 'title' => __('Add new Reply', 'bbpaba')));
        }
        // end-if cap check
        /** Users section */
        if (current_user_can('edit_users')) {
            $menu_items['users'] = array('parent' => $bbpressbar, 'title' => __('Users', 'bbpaba'), 'href' => is_network_admin() ? network_admin_url('users.php') : admin_url('users.php'), 'meta' => array('target' => '', 'title' => __('Users', 'bbpaba')));
        }
        // end-if can edit_users
        if (current_user_can('add_users')) {
            $menu_items['u-add-user'] = array('parent' => $users, 'title' => __('Add new User', 'bbpaba'), 'href' => is_network_admin() ? network_admin_url('user-new.php') : admin_url('user-new.php'), 'meta' => array('target' => '', 'title' => __('Add new User', 'bbpaba')));
        }
        // end-if can add_users
        /**
         * Display last main item in the menu for active extensions/plugins
         * ATTENTION: This is where plugins/extensions hook in on the sub-level hierarchy
         *
         * @since 1.0
         * @version 1.1
         */
        if (BBPABA_EXTENSIONS_DISPLAY && current_user_can('activate_plugins')) {
            $menu_items['extensions'] = array('parent' => $bbpressbar, 'title' => __('Active Extensions', 'bbpaba'), 'href' => is_network_admin() ? network_admin_url('plugins.php') : admin_url('plugins.php'), 'meta' => array('target' => '', 'title' => _x('Active Extensions', 'Translators: For the tooltip', 'bbpaba')));
            /**
             * Action Hook 'bbpaba_custom_extension_items'
             * allows for hooking other extension-related items in
             *
             * @since 1.5
             */
            do_action('bbpaba_custom_extension_items');
        }
        // end-if constant & cap check for displaying extensions
    } else {
        /** If bbPress is not active "void" main settings link */
        $bbp_aurl_main = false;
    }
    // end-if bbPress conditional
    /**
     * Display links to active bbPress 2.x plugins/extensions settings' pages
     *
     * @since 1.0
     * @version 1.2
     */
    /** Include plugin file with plugin support links */
    require_once BBPABA_PLUGIN_DIR . '/includes/bbpaba-plugins.php';
    /**
     * Display links to active bbPress 2.x compatible/specific themes settings' pages
     *
     * @since 1.5
     */
    /** Include plugin file with theme support links */
    if (BBPABA_THEMES_DISPLAY) {
        require_once BBPABA_PLUGIN_DIR . '/includes/bbpaba-themes.php';
        /**
         * Action Hook 'bbpaba_custom_theme_items'
         * allows for hooking other theme-related items in
         *
         * @since 1.5
         */
        do_action('bbpaba_custom_theme_items');
    }
    // end-if constant check
    /** Allow menu items to be filtered, but pass in parent menu item IDs */
    $menu_items = (array) apply_filters('ddw_bbpress_aba_menu_items', $menu_items, $prefix, $bbpressbar, $bbpsupport, $bbpdocumentation, $bbpknowledgebase, $bbpsites, $bbpsettings, $forums, $forumsfrontbase, $f_gdtools, $f_gdtoolbox, $topics, $replies, $users, $userswangguard, $extensions, $extgdtools, $extgdtoolbox, $extwangguard, $extcptprivacy, $extbbpconvert, $exts2member, $bbpgroup);
    // end of array
    /**
     * Add the bbPress top-level menu item
     *
     * @since 1.0
     * @version 1.1
     *
     * @param $bbpaba_main_item_title
     * @param $bbpaba_main_item_title_tooltip
     * @param $bbpaba_main_item_icon_display
     */
    /** Filter the main item name */
    $bbpaba_main_item_title = apply_filters('bbpaba_filter_main_item', __('bbPress', 'bbpaba'));
    /** Filter the main item name's tooltip */
    $bbpaba_main_item_title_tooltip = apply_filters('bbpaba_filter_main_item_tooltip', _x('bbPress Forums', 'Translators: For the tooltip', 'bbpaba'));
    /** Filter the main item icon's class/display */
    $bbpaba_main_item_icon_display = apply_filters('bbpaba_filter_main_item_icon_display', 'icon-bbpress');
    $wp_admin_bar->add_menu(array('id' => $bbpressbar, 'title' => esc_attr__($bbpaba_main_item_title), 'href' => $bbp_aurl_main, 'meta' => array('class' => esc_attr($bbpaba_main_item_icon_display), 'title' => esc_attr__($bbpaba_main_item_title_tooltip))));
    /** Loop through the menu items */
    foreach ($menu_items as $id => $menu_item) {
        /** Add in the item ID */
        $menu_item['id'] = $prefix . $id;
        /** Add meta target to each item where it's not already set, so links open in new window/tab */
        if (!isset($menu_item['meta']['target'])) {
            $menu_item['meta']['target'] = '_blank';
        }
        /** Add class to links that open up in a new window/tab */
        if ('_blank' === $menu_item['meta']['target']) {
            if (!isset($menu_item['meta']['class'])) {
                $menu_item['meta']['class'] = '';
            }
            $menu_item['meta']['class'] .= $prefix . 'bbpaba-new-tab';
        }
        /** Add menu items */
        $wp_admin_bar->add_menu($menu_item);
    }
    // end foreach
    /**
     * Action Hook 'bbpaba_custom_main_items'
     * allows for hooking other main items in
     *
     * @since 1.5
     */
    do_action('bbpaba_custom_main_items');
    /**
     * Check for WordPress version to add resource links group
     * Check against WP 3.3+ only function "wp_editor" - if true display group styling
     * otherwise display links in WP 3.1/3.2 style
     *
     * @since 1.4
     */
    if (function_exists('wp_editor')) {
        $wp_admin_bar->add_group(array('parent' => $bbpressbar, 'id' => $bbpgroup, 'meta' => array('class' => 'ab-sub-secondary')));
    } else {
        $wp_admin_bar->add_menu(array('parent' => $bbpressbar, 'id' => $bbpgroup));
    }
    // end-if wp version check
    /**
     * Action Hook 'bbpaba_custom_group_items'
     * allows for hooking other bbPress Group items in
     *
     * @since 1.5
     */
    do_action('bbpaba_custom_group_items');
}