Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/10/2014 07:13:04 PM (11 years ago)
Author:
imath
Message:

Improve Group's Edit WP Admin Bar menu

Use the group's manage options nav to populate the different edit links of the group's Edit WP Admin Bar.
Introduce a new parameter show_in_admin_bar for the edit screen property of the Group Extension API to allow plugins add their edit link into this Admin Bar (if this parameter is set to true).

props boonebgorges

Fixes #6002

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-buddybar.php

    r8568 r9131  
    254254 *     @type string $link Optional. The URL that the subnav item should point
    255255 *           to. Defaults to a value generated from the $parent_url + $slug.
     256 *     @type bool $show_in_admin_bar Optional. Whether the nav item should be
     257 *           added into the group's "Edit" Admin Bar menu for group admins.
     258 *           Default: false.
    256259 * }
    257260 * @return bool|null Returns false on failure.
     
    261264
    262265    $r = wp_parse_args( $args, array(
    263         'name'            => false, // Display name for the nav item
    264         'slug'            => false, // URL slug for the nav item
    265         'parent_slug'     => false, // URL slug of the parent nav item
    266         'parent_url'      => false, // URL of the parent item
    267         'item_css_id'     => false, // The CSS ID to apply to the HTML of the nav item
    268         'user_has_access' => true,  // Can the logged in user see this nav item?
    269         'no_access_url'   => '',
    270         'site_admin_only' => false, // Can only site admins see this nav item?
    271         'position'        => 90,    // Index of where this nav item should be positioned
    272         'screen_function' => false, // The name of the function to run when clicked
    273         'link'            => ''     // The link for the subnav item; optional, not usually required.
     266        'name'              => false, // Display name for the nav item
     267        'slug'              => false, // URL slug for the nav item
     268        'parent_slug'       => false, // URL slug of the parent nav item
     269        'parent_url'        => false, // URL of the parent item
     270        'item_css_id'       => false, // The CSS ID to apply to the HTML of the nav item
     271        'user_has_access'   => true,  // Can the logged in user see this nav item?
     272        'no_access_url'     => '',
     273        'site_admin_only'   => false, // Can only site admins see this nav item?
     274        'position'          => 90,    // Index of where this nav item should be positioned
     275        'screen_function'   => false, // The name of the function to run when clicked
     276        'link'              => '',    // The link for the subnav item; optional, not usually required.
     277        'show_in_admin_bar' => false, // Show the Manage link in the current group's "Edit" Admin Bar menu
    274278    ) );
    275279
     
    298302
    299303    $subnav_item = array(
    300         'name'            => $name,
    301         'link'            => trailingslashit( $link ),
    302         'slug'            => $slug,
    303         'css_id'          => $item_css_id,
    304         'position'        => $position,
    305         'user_has_access' => $user_has_access,
    306         'no_access_url'   => $no_access_url,
    307         'screen_function' => &$screen_function
     304        'name'              => $name,
     305        'link'              => trailingslashit( $link ),
     306        'slug'              => $slug,
     307        'css_id'            => $item_css_id,
     308        'position'          => $position,
     309        'user_has_access'   => $user_has_access,
     310        'no_access_url'     => $no_access_url,
     311        'screen_function'   => &$screen_function,
     312        'show_in_admin_bar' => (bool) $r['show_in_admin_bar'],
    308313    );
     314
    309315    $bp->bp_options_nav[$parent_slug][$slug] = $subnav_item;
    310316
Note: See TracChangeset for help on using the changeset viewer.