Skip to:
Content

BuddyPress.org

Changeset 4586


Ignore:
Timestamp:
07/04/2011 05:37:22 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Admin bar and navigation tweaks:

  • Add Displayed user/Displayed group avatars and names to moderation menus.
  • Add WP admin bar sprites and custom CSS for new admin bar items.
  • Audit text of navigation elements and remove references to "My" or "Your" as needed.
  • Add missing WP core functions to root blog menu item.
Location:
trunk
Files:
4 added
11 edited

Legend:

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

    r4564 r4586  
    1010 */
    1111
    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
     12if ( !defined( 'BP_USE_WP_ADMIN_BAR' ) || defined( 'DOING_AJAX' ) )
     13    return;
     14
     15/**
     16 * Unhook the WordPress core menus.
    1717 *
    1818 * @since BuddyPress (r4151)
     
    2323 */
    2424function bp_admin_bar_remove_wp_menus() {
     25
    2526    remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 );
    26    
     27    remove_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
     28    remove_action( 'admin_bar_menu', 'wp_admin_bar_dashboard_view_site_menu', 25 );
     29
    2730    // Don't show the 'Edit Page' menu on BP pages
    28     if ( !bp_is_blog_page() ) 
     31    if ( !bp_is_blog_page() )
    2932        remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 );
    3033
    31     /*remove_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu',   20 );
    32     remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu',       30 );
    33     remove_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu',  80 );
     34    remove_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
     35    remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
    3436
    3537    if ( !is_network_admin() && !is_user_admin() ) {
    36         remove_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 );
    37         remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu',    50 );
    38         remove_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu',  60 );
     38        remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
     39        remove_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu', 60 );
    3940    }
    4041
    41     remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu',    70 );*/
    42 }
    43 if ( defined( 'BP_USE_WP_ADMIN_BAR' ) )
    44     add_action( 'bp_init', 'bp_admin_bar_remove_wp_menus', 2 );
    45 
    46 
     42    remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
     43}
     44add_action( 'bp_init', 'bp_admin_bar_remove_wp_menus', 2 );
     45
     46/**
     47 * Add a menu for the root site of this BuddyPress network
     48 *
     49 * @global type $bp
     50 * @global type $wp_admin_bar
     51 * @return If in ajax
     52 */
     53function bp_admin_bar_root_site() {
     54    global $bp, $wp_admin_bar;
     55
     56    // Create the root blog menu
     57    $wp_admin_bar->add_menu( array(
     58        'id'    => 'bp-root-blog',
     59        'title' => get_blog_option( BP_ROOT_BLOG, 'blogname' ),
     60        'href'  => bp_get_root_domain()
     61    ) );
     62
     63    // Logged in user
     64    if ( is_user_logged_in() ) {
     65
     66        // Dashboard links
     67        if ( is_super_admin() ) {
     68
     69            // Add site admin link
     70            $wp_admin_bar->add_menu( array(
     71                'id' => 'dashboard',
     72                'parent' => 'bp-root-blog',
     73                'title' => __( 'Admin Dashboard', 'buddypress' ),
     74                'href' => get_admin_url( BP_ROOT_BLOG )
     75            ) );
     76
     77            // Add network admin link
     78            if ( is_multisite() ) {
     79
     80                // Link to the network admin dashboard
     81                $wp_admin_bar->add_menu( array(
     82                    'id' => 'network-dashboard',
     83                    'parent' => 'bp-root-blog',
     84                    'title' => __( 'Network Dashboard', 'buddypress' ),
     85                    'href' => network_admin_url()
     86                ) );
     87            }
     88        }
     89    }
     90}
     91add_action( 'bp_setup_admin_bar', 'bp_admin_bar_root_site', 3 );
     92
     93/**
     94 * Add the "My Sites/[Site Name]" menu and all submenus.
     95 */
     96function bp_admin_bar_my_sites_menu() {
     97    global $wpdb, $wp_admin_bar;
     98
     99    /* Add the 'My Sites' menu if the user has more than one site. */
     100    if ( count( $wp_admin_bar->user->blogs ) <= 1 )
     101        return;
     102
     103    $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Sites' ), 'href' => admin_url( 'my-sites.php' ) ) );
     104
     105    $default = includes_url( 'images/wpmini-blue.png' );
     106
     107    foreach ( (array)$wp_admin_bar->user->blogs as $blog ) {
     108        // @todo Replace with some favicon lookup.
     109        //$blavatar = '<img src="' . esc_url( blavatar_url( blavatar_domain( $blog->siteurl ), 'img', 16, $default ) ) . '" alt="Blavatar" width="16" height="16" />';
     110        $blavatar = '<img src="' . esc_url( $default ) . '" alt="' . esc_attr__( 'Blavatar' ) . '" width="16" height="16" class="blavatar"/>';
     111
     112        $blogname = empty( $blog->blogname ) ? $blog->domain : $blog->blogname;
     113
     114        $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-' . $blog->userblog_id, 'title' => $blavatar . $blogname, 'href' => get_admin_url( $blog->userblog_id ) ) );
     115        $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-d', 'title' => __( 'Dashboard' ), 'href' => get_admin_url( $blog->userblog_id ) ) );
     116
     117        if ( current_user_can_for_blog( $blog->userblog_id, 'edit_posts' ) ) {
     118            $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-n', 'title' => __( 'New Post' ), 'href' => get_admin_url( $blog->userblog_id, 'post-new.php' ) ) );
     119            $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-c', 'title' => __( 'Manage Comments' ), 'href' => get_admin_url( $blog->userblog_id, 'edit-comments.php' ) ) );
     120        }
     121
     122        $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-v', 'title' => __( 'Visit Site' ), 'href' => get_home_url( $blog->userblog_id ) ) );
     123    }
     124}
     125add_action( 'bp_setup_admin_bar', 'bp_admin_bar_my_sites_menu', 3 );
     126
     127/**
     128 * Add edit comments link with awaiting moderation count bubble
     129 */
     130function bp_admin_bar_comments_menu( $wp_admin_bar ) {
     131    global $wp_admin_bar;
     132
     133    if ( !current_user_can( 'edit_posts' ) )
     134        return;
     135
     136    $awaiting_mod = wp_count_comments();
     137    $awaiting_mod = $awaiting_mod->moderated;
     138
     139    $awaiting_mod = $awaiting_mod ? "<span id='ab-awaiting-mod' class='pending-count'>" . number_format_i18n( $awaiting_mod ) . "</span>" : '';
     140    $wp_admin_bar->add_menu( array( 'parent' => 'dashboard', 'id' => 'comments', 'title' => sprintf( __( 'Comments %s' ), $awaiting_mod ), 'href' => admin_url( 'edit-comments.php' ) ) );
     141}
     142add_action( 'bp_setup_admin_bar', 'bp_admin_bar_comments_menu', 3 );
     143
     144/**
     145 * Add "Appearance" menu with widget and nav menu submenu
     146 */
     147function bp_admin_bar_appearance_menu() {
     148    global $wp_admin_bar;
     149
     150    // You can have edit_theme_options but not switch_themes.
     151    if ( !current_user_can( 'switch_themes' ) && !current_user_can( 'edit_theme_options' ) )
     152        return;
     153
     154    $wp_admin_bar->add_menu( array( 'parent' => 'dashboard', 'id' => 'appearance', 'title' => __( 'Appearance' ), 'href' => admin_url( 'themes.php' ) ) );
     155
     156    if ( !current_user_can( 'edit_theme_options' ) )
     157        return;
     158
     159    if ( current_user_can( 'switch_themes' ) )
     160        $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __( 'Themes' ), 'href' => admin_url( 'themes.php' ) ) );
     161
     162    if ( current_theme_supports( 'widgets' ) )
     163        $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __( 'Widgets' ), 'href' => admin_url( 'widgets.php' ) ) );
     164
     165    if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
     166        $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __( 'Menus' ), 'href' => admin_url( 'nav-menus.php' ) ) );
     167
     168    if ( current_theme_supports( 'custom-background' ) )
     169        $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'background', 'title' => __( 'Background' ), 'href' => admin_url( 'themes.php?page=custom-background' ) ) );
     170
     171    if ( current_theme_supports( 'custom-header' ) )
     172        $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'header', 'title' => __( 'Header' ), 'href' => admin_url( 'themes.php?page=custom-header' ) ) );
     173}
     174add_action( 'bp_setup_admin_bar', 'bp_admin_bar_appearance_menu', 3 );
     175
     176/**
     177 * Provide an update link if theme/plugin/core updates are available
     178 */
     179function bp_admin_bar_updates_menu() {
     180    global $wp_admin_bar;
     181
     182    if ( !current_user_can( 'install_plugins' ) )
     183        return;
     184
     185    $plugin_update_count = $theme_update_count = $wordpress_update_count = 0;
     186    $update_plugins = get_site_transient( 'update_plugins' );
     187    if ( !empty( $update_plugins->response ) )
     188        $plugin_update_count = count( $update_plugins->response );
     189    $update_themes = get_site_transient( 'update_themes' );
     190    if ( !empty( $update_themes->response ) )
     191        $theme_update_count = count( $update_themes->response );
     192    /* @todo get_core_updates() is only available on admin page loads
     193      $update_wordpress = get_core_updates( array('dismissed' => false) );
     194      if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) )
     195      $wordpress_update_count = 1;
     196     */
     197
     198    $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;
     199
     200    if ( !$update_count )
     201        return;
     202
     203    $update_title = array( );
     204    if ( $wordpress_update_count )
     205        $update_title[] = sprintf( __( '%d WordPress Update' ), $wordpress_update_count );
     206    if ( $plugin_update_count )
     207        $update_title[] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $plugin_update_count ), $plugin_update_count );
     208    if ( $theme_update_count )
     209        $update_title[] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $theme_update_count ), $theme_update_count );
     210
     211    $update_title = !empty( $update_title ) ? esc_attr( implode( ', ', $update_title ) ) : '';
     212
     213    $update_title = "<span title='$update_title'>";
     214    $update_title .= sprintf( __( 'Updates %s' ), "<span id='ab-updates' class='update-count'>" . number_format_i18n( $update_count ) . '</span>' );
     215    $update_title .= '</span>';
     216
     217    $wp_admin_bar->add_menu( array( 'parent' => 'dashboard', 'id' => 'updates', 'title' => $update_title, 'href' => network_admin_url( 'update-core.php' ) ) );
     218}
     219add_action( 'bp_setup_admin_bar', 'bp_admin_bar_updates_menu', 3 );
     220
     221/**
     222 * Handle the Admin Bar CSS
     223 */
     224function bp_core_load_admin_bar_css() {
     225    global $wp_version;
     226
     227    // Admin bar styles
     228    if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
     229        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin-bar.dev.css';
     230    else
     231        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin-bar.css';
     232
     233    wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', $stylesheet ), array( 'admin-bar' ), BP_VERSION );
     234
     235    if ( !is_rtl() )
     236        return;
     237
     238    if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
     239        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin_bar-rtl.dev.css';
     240    else
     241        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin_bar-rtl.css';
     242
     243    wp_enqueue_style( 'bp-admin-bar-rtl', apply_filters( 'bp_core_admin_bar_rtl_css', $stylesheet ), array( 'bp-admin-bar' ), BP_VERSION );
     244}
     245add_action( 'bp_init', 'bp_core_load_admin_bar_css' );
    47246
    48247?>
  • trunk/bp-core/bp-core-functions.php

    r4585 r4586  
    1717 * @return mixed The value for the option
    1818 */
    19 function bp_get_option( $option_name, $default = false ) {
     19function bp_get_option( $option_name, $default = '' ) {
    2020    $value = get_blog_option( bp_get_option_blog_id( $option_name ), $option_name, $default );
    2121   
  • trunk/bp-core/bp-core-loader.php

    r4559 r4586  
    138138        // Fetches all of the core BuddyPress settings in one fell swoop
    139139        if ( empty( $bp->site_options ) )
    140             $bp->site_options = bp_core_get_site_options();
     140            $bp->site_options = bp_core_get_root_options();
    141141
    142142        // The names of the core WordPress pages used to display BuddyPress content
  • trunk/bp-forums/bp-forums-loader.php

    r4321 r4586  
    133133        // Additional menu if friends is active
    134134        $sub_nav[] = array(
    135             'name'            => __( 'Started', 'buddypress' ),
     135            'name'            => __( 'Topics Started', 'buddypress' ),
    136136            'slug'            => 'topics',
    137137            'parent_url'      => $forums_link,
     
    199199            $wp_admin_nav[] = array(
    200200                'parent' => 'my-account-' . $this->id,
    201                 'title'  => __( 'My Topics', 'buddypress' ),
     201                'title'  => __( 'Topics Started', 'buddypress' ),
    202202                'href'   => trailingslashit( $forums_link . 'topics' )
    203203            );
     
    206206            $wp_admin_nav[] = array(
    207207                'parent' => 'my-account-' . $this->id,
    208                 'title'  => __( 'My Replies', 'buddypress' ),
     208                'title'  => __( 'Replies', 'buddypress' ),
    209209                'href'   => trailingslashit( $forums_link . 'replies' )
    210210            );
     
    213213            $wp_admin_nav[] = array(
    214214                'parent' => 'my-account-' . $this->id,
    215                 'title'  => __( 'My Favorites', 'buddypress' ),
     215                'title'  => __( 'Favorite Topics', 'buddypress' ),
    216216                'href'   => trailingslashit( $forums_link . 'favorites' )
    217217            );
     
    232232        if ( bp_is_forums_component() ) {
    233233            if ( bp_is_my_profile() ) {
    234                 $bp->bp_options_title = __( 'My Forums', 'buddypress' );
     234                $bp->bp_options_title = __( 'Forums', 'buddypress' );
    235235            } else {
    236236                $bp->bp_options_avatar = bp_core_fetch_avatar( array(
  • trunk/bp-friends/bp-friends-loader.php

    r4381 r4586  
    107107        // Add the subnav items to the friends nav item
    108108        $sub_nav[] = array(
    109             'name' => __( 'My Friends', 'buddypress' ),
     109            'name' => __( 'Friendships', 'buddypress' ),
    110110            'slug' => 'my-friends',
    111111            'parent_url' => $friends_link,
     
    167167            $wp_admin_nav[] = array(
    168168                'parent' => 'my-account-' . $this->id,
    169                 'title'  => __( 'My Friends', 'buddypress' ),
     169                'title'  => __( 'Friendships', 'buddypress' ),
    170170                'href'   => trailingslashit( $friends_link )
    171171            );
     
    193193        if ( bp_is_friends_component() ) {
    194194            if ( bp_is_my_profile() ) {
    195                 $bp->bp_options_title = __( 'My Friends', 'buddypress' );
     195                $bp->bp_options_title = __( 'Friendships', 'buddypress' );
    196196            } else {
    197197                $bp->bp_options_avatar = bp_core_fetch_avatar( array(
  • trunk/bp-groups/bp-groups-adminbar.php

    r4570 r4586  
    2929        return false;
    3030
     31    // Group avatar
     32    $avatar = bp_core_fetch_avatar( array(
     33        'object'     => 'group',
     34        'type'       => 'thumb',
     35        'avatar_dir' => 'group-avatars',
     36        'item_id'    => $bp->groups->current_group->id,
     37        'width'      => 16,
     38        'height'     => 16
     39    ) );
     40
     41    // Unique ID for the 'My Account' menu
     42    $bp->group_admin_menu_id = ( ! empty( $avatar ) ) ? 'group-admin-with-avatar' : 'group-admin';
     43
    3144    // Add the top-level Group Admin button
    3245    $wp_admin_bar->add_menu( array(
    33         'id'    => 'group-admin',
    34         'title' => __( 'Group Admin', 'buddypress' ),
    35         'href'  => bp_displayed_user_domain()
     46        'id'    => $bp->group_admin_menu_id,
     47        'title' => $avatar . bp_get_current_group_name(),
     48        'href'  => bp_get_group_permalink( $bp->groups->current_group )
    3649    ) );
    3750   
    3851    // Group Admin > Edit details
    3952    $wp_admin_bar->add_menu( array(
    40         'parent' => 'group-admin',
     53        'parent' => $bp->group_admin_menu_id,
    4154        'id'     => 'edit-details',
    42         'title'  => __( "Edit Details", 'buddypress' ),
     55        'title'  => __( 'Edit Details', 'buddypress' ),
    4356        'href'   =>  bp_get_groups_action_link( 'admin/edit-details' )
    4457    ) );
     
    4659    // Group Admin > Group settings
    4760    $wp_admin_bar->add_menu( array(
    48         'parent' => 'group-admin',
     61        'parent' => $bp->group_admin_menu_id,
    4962        'id'     => 'group-settings',
    50         'title'  => __( "Group Settings", 'buddypress' ),
     63        'title'  => __( 'Edit Settings', 'buddypress' ),
    5164        'href'   =>  bp_get_groups_action_link( 'admin/group-settings' )
    5265    ) );
     
    5467    // Group Admin > Group avatar
    5568    $wp_admin_bar->add_menu( array(
    56         'parent' => 'group-admin',
     69        'parent' => $bp->group_admin_menu_id,
    5770        'id'     => 'group-avatar',
    58         'title'  => __( "Group Avatar", 'buddypress' ),
     71        'title'  => __( 'Edit Avatar', 'buddypress' ),
    5972        'href'   =>  bp_get_groups_action_link( 'admin/group-avatar' )
    6073    ) );
     
    6376    if ( bp_is_active( 'friends' ) ) {
    6477        $wp_admin_bar->add_menu( array(
    65             'parent' => 'group-admin',
     78            'parent' => $bp->group_admin_menu_id,
    6679            'id'     => 'manage-invitations',
    67             'title'  => __( "Manage Invitations", 'buddypress' ),
     80            'title'  => __( 'Manage Invitations', 'buddypress' ),
    6881            'href'   =>  bp_get_groups_action_link( 'send-invites' )
    6982        ) );
     
    7285    // Group Admin > Manage members
    7386    $wp_admin_bar->add_menu( array(
    74         'parent' => 'group-admin',
     87        'parent' => $bp->group_admin_menu_id,
    7588        'id'     => 'manage-members',
    76         'title'  => __( "Manage Members", 'buddypress' ),
     89        'title'  => __( 'Manage Members', 'buddypress' ),
    7790        'href'   =>  bp_get_groups_action_link( 'admin/manage-members' )
    7891    ) );
     
    8194    if ( bp_get_group_status( $bp->groups->current_group ) == 'private' ) {
    8295        $wp_admin_bar->add_menu( array(
    83             'parent' => 'group-admin',
     96            'parent' => $bp->group_admin_menu_id,
    8497            'id'     => 'membership-requests',
    85             'title'  => __( "Membership Requests", 'buddypress' ),
     98            'title'  => __( 'Membership Requests', 'buddypress' ),
    8699            'href'   =>  bp_get_groups_action_link( 'admin/membership-requests' )
    87100        ) );
     
    90103    // Delete Group
    91104    $wp_admin_bar->add_menu( array(
    92         'parent' => 'group-admin',
     105        'parent' => $bp->group_admin_menu_id,
    93106        'id'     => 'delete-group',
    94         'title'  => __( "Delete Group", 'buddypress' ),
     107        'title'  => __( 'Delete Group', 'buddypress' ),
    95108        'href'   =>  bp_get_groups_action_link( 'admin/delete-group' )
    96109    ) );
  • trunk/bp-groups/bp-groups-loader.php

    r4570 r4586  
    235235        // Add the My Groups nav item
    236236        $sub_nav[] = array(
    237             'name'            => __( 'My Groups', 'buddypress' ),
     237            'name'            => __( 'Memberships', 'buddypress' ),
    238238            'slug'            => 'my-groups',
    239239            'parent_url'      => $groups_link,
     
    246246        // Add the Group Invites nav item
    247247        $sub_nav[] = array(
    248             'name'            => __( 'Invitations',   'buddypress' ),
     248            'name'            => __( 'Invitations', 'buddypress' ),
    249249            'slug'            => 'invites',
    250250            'parent_url'      => $groups_link,
     
    263263            // Add 'Groups' to the main navigation
    264264            $main_nav = array(
    265                 'name'                => __( 'Groups', 'buddypress' ),
     265                'name'                => __( 'Memberships', 'buddypress' ),
    266266                'slug'                => $this->current_group->slug,
    267267                'position'            => -1, // Do not show in BuddyBar
     
    402402            $wp_admin_nav[] = array(
    403403                'parent' => 'my-account-' . $this->id,
    404                 'title'  => __( 'My Groups', 'buddypress' ),
     404                'title'  => __( 'Memberships', 'buddypress' ),
    405405                'href'   => trailingslashit( $groups_link )
    406406            );
     
    429429            if ( bp_is_my_profile() && !bp_is_single_item() ) {
    430430
    431                 $bp->bp_options_title = __( 'My Groups', 'buddypress' );
     431                $bp->bp_options_title = __( 'Memberships', 'buddypress' );
    432432
    433433            } else if ( !bp_is_my_profile() && !bp_is_single_item() ) {
  • trunk/bp-groups/bp-groups-template.php

    r4559 r4586  
    12421242?>
    12431243    <?php if ( $bp->is_item_admin || $bp->is_item_mod ) { ?>
    1244         <li<?php if ( 'edit-details' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/edit-details"><?php _e('Edit Details', 'buddypress') ?></a></li>
     1244        <li<?php if ( 'edit-details' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/edit-details"><?php _e( 'Details', 'buddypress' ); ?></a></li>
    12451245    <?php } ?>
    12461246
     
    12491249            return false;
    12501250    ?>
    1251     <li<?php if ( 'group-settings' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/group-settings"><?php _e('Group Settings', 'buddypress') ?></a></li>
    1252     <li<?php if ( 'group-avatar' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/group-avatar"><?php _e('Group Avatar', 'buddypress') ?></a></li>
    1253     <li<?php if ( 'manage-members' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/manage-members"><?php _e('Manage Members', 'buddypress') ?></a></li>
     1251    <li<?php if ( 'group-settings' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/group-settings"><?php _e( 'Settings', 'buddypress' ); ?></a></li>
     1252    <li<?php if ( 'group-avatar' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/group-avatar"><?php _e( 'Avatar', 'buddypress' ); ?></a></li>
     1253    <li<?php if ( 'manage-members' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/manage-members"><?php _e( 'Members', 'buddypress' ); ?></a></li>
    12541254
    12551255    <?php if ( $groups_template->group->status == 'private' ) : ?>
    1256         <li<?php if ( 'membership-requests' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/membership-requests"><?php _e('Membership Requests', 'buddypress') ?></a></li>
     1256        <li<?php if ( 'membership-requests' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/membership-requests"><?php _e( 'Requests', 'buddypress' ); ?></a></li>
    12571257    <?php endif; ?>
    12581258
    12591259    <?php do_action( 'groups_admin_tabs', $current_tab, $group->slug ) ?>
    12601260
    1261     <li<?php if ( 'delete-group' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/delete-group"><?php _e('Delete Group', 'buddypress') ?></a></li>
     1261    <li<?php if ( 'delete-group' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo bp_get_root_domain() . '/' . $bp->groups->root_slug ?>/<?php echo $group->slug ?>/admin/delete-group"><?php _e( 'Delete', 'buddypress' ); ?></a></li>
    12621262<?php
    12631263}
  • trunk/bp-members/bp-members-adminbar.php

    r4570 r4586  
    2222        return;
    2323
    24     // Create the root blog menu
    25     $wp_admin_bar->add_menu( array(
    26         'id'    => 'bp-root-blog',
    27         'title' => get_blog_option( BP_ROOT_BLOG, 'blogname' ),
    28         'href'  => bp_get_root_domain()
    29     ) );
    30 
    3124    // Logged in user
    3225    if ( is_user_logged_in() ) {
    33 
    34         // Dashboard links
    35         if ( is_super_admin() ) {
    36 
    37             // Add site admin link
    38             $wp_admin_bar->add_menu( array(
    39                 'parent' => 'bp-root-blog',
    40                 'title'  => __( 'Admin Dashboard', 'buddypress' ),
    41                 'href'   => get_admin_url( BP_ROOT_BLOG )
    42             ) );
    43 
    44             // Add network admin link
    45             if ( is_multisite() ) {
    46 
    47                 // Link to the network admin dashboard
    48                 $wp_admin_bar->add_menu( array(
    49                     'parent' => 'bp-root-blog',
    50                     'title'  => __( 'Network Dashboard', 'buddypress' ),
    51                     'href'   => network_admin_url()
    52                 ) );
    53             }
    54         }
    5526
    5627        // User avatar
     
    6839        $wp_admin_bar->add_menu( array(
    6940            'id'    => $bp->my_account_menu_id,
    70             'title' => $avatar . bp_get_user_firstname( $bp->loggedin_user->fullname ),
     41            'title' => $avatar . bp_get_loggedin_user_fullname(),
    7142            'href'  => $bp->loggedin_user->domain
    7243        ) );
     
    10374 */
    10475function bp_members_user_admin_menu() {
    105     global $wp_admin_bar;
     76    global $bp, $wp_admin_bar;
    10677
    10778    // Only show if viewing a user
     
    11384        return false;
    11485
     86    // User avatar
     87    $avatar = bp_core_fetch_avatar( array(
     88        'item_id' => $bp->displayed_user->id,
     89        'email'   => $bp->displayed_user->userdata->user_email,
     90        'width'   => 16,
     91        'height'  => 16
     92    ) );
     93
     94    // Unique ID for the 'My Account' menu
     95    $bp->user_admin_menu_id = ( ! empty( $avatar ) ) ? 'user-admin-with-avatar' : 'user-admin';
     96
    11597    // Add the top-level User Admin button
    11698    $wp_admin_bar->add_menu( array(
    117         'id'    => 'user-admin',
    118         'title' => __( 'User Admin', 'buddypress' ),
     99        'id'    => $bp->user_admin_menu_id,
     100        'title' => $avatar . bp_get_displayed_user_fullname(),
    119101        'href'  => bp_displayed_user_domain()
    120102    ) );
     
    122104    // User Admin > Edit this user's profile
    123105    $wp_admin_bar->add_menu( array(
    124         'parent' => 'user-admin',
     106        'parent' => $bp->user_admin_menu_id,
    125107        'id'     => 'edit-profile',
    126         'title'  => sprintf( __( "Edit %s's Profile", 'buddypress' ), bp_get_displayed_user_fullname() ),
     108        'title'  => __( "Edit Profile", 'buddypress' ),
    127109        'href'   => bp_get_members_component_link( 'profile', 'edit' )
    128110    ) );
     
    130112    // User Admin > Edit this user's avatar
    131113    $wp_admin_bar->add_menu( array(
    132         'parent' => 'user-admin',
     114        'parent' => $bp->user_admin_menu_id,
    133115        'id'     => 'change-avatar',
    134         'title'  => sprintf( __( "Edit %s's Avatar", 'buddypress' ), bp_get_displayed_user_fullname() ),
    135         'href'   => bp_get_members_component_link( 'profile', 'change-avatar' )
    136     ) );
    137    
    138     // User Admin > Edit this user's avatar
    139     $wp_admin_bar->add_menu( array(
    140         'parent' => 'user-admin',
    141         'id'     => 'change-avatar',
    142         'title'  => sprintf( __( "Edit %s's Avatar", 'buddypress' ), bp_get_displayed_user_fullname() ),
     116        'title'  => __( "Edit Avatar", 'buddypress' ),
    143117        'href'   => bp_get_members_component_link( 'profile', 'change-avatar' )
    144118    ) );
     
    147121    if ( !bp_core_is_user_spammer( bp_displayed_user_id() ) ) {
    148122        $wp_admin_bar->add_menu( array(
    149             'parent' => 'user-admin',
     123            'parent' => $bp->user_admin_menu_id,
    150124            'id'     => 'spam-user',
    151             'title'  => __( "Mark as Spammer", 'buddypress' ),
     125            'title'  => __( 'Mark as Spammer', 'buddypress' ),
    152126            'href'   => wp_nonce_url( bp_displayed_user_domain() . 'admin/mark-spammer/', 'mark-unmark-spammer' ),
    153127            'meta'   => array( 'onclick' => 'confirm(" ' . __( 'Are you sure you want to mark this user as a spammer?', 'buddypress' ) . '");' )
     
    155129    } else {
    156130        $wp_admin_bar->add_menu( array(
    157             'parent' => 'user-admin',
     131            'parent' => $bp->user_admin_menu_id,
    158132            'id'     => 'unspam-user',
    159             'title'  => __( "Not a Spammer", 'buddypress' ),
     133            'title'  => __( 'Not a Spammer', 'buddypress' ),
    160134            'href'   => wp_nonce_url( bp_displayed_user_domain() . 'admin/unmark-spammer/', 'mark-unmark-spammer' ),
    161135            'meta'   => array( 'onclick' => 'confirm(" ' . __( 'Are you sure you want to mark this user as not a spammer?', 'buddypress' ) . '");' )
     
    165139    // User Admin > Delete Account
    166140    $wp_admin_bar->add_menu( array(
    167         'parent' => 'user-admin',
     141        'parent' => $bp->user_admin_menu_id,
    168142        'id'     => 'delete-user',
    169         'title'  => sprintf( __( "Delete %s's Account", 'buddypress' ), bp_get_displayed_user_fullname() ),
     143        'title'  => __( 'Delete Account', 'buddypress' ),
    170144        'href'   => wp_nonce_url( bp_displayed_user_domain() . 'admin/delete-user/', 'delete-user' ),
    171145        'meta'   => array( 'onclick' => 'confirm(" ' . __( "Are you sure you want to delete this user's account?", 'buddypress' ) . '");' )
  • trunk/bp-messages/bp-messages-loader.php

    r4381 r4586  
    125125
    126126        $sub_nav[] = array(
    127             'name'            => __( 'Sent Messages', 'buddypress' ),
     127            'name'            => __( 'Sent', 'buddypress' ),
    128128            'slug'            => 'sentbox',
    129129            'parent_url'      => $messages_link,
  • trunk/bp-xprofile/bp-xprofile-loader.php

    r4381 r4586  
    135135        // Edit Profile
    136136        $sub_nav[] = array(
    137             'name'            => __( 'Edit Profile', 'buddypress' ),
     137            'name'            => __( 'Edit', 'buddypress' ),
    138138            'slug'            => 'edit',
    139139            'parent_url'      => $profile_link,
     
    184184            $wp_admin_nav[] = array(
    185185                'parent' => 'my-account-' . $this->id,
    186                 'title'  => __( 'View My Profile', 'buddypress' ),
     186                'title'  => __( 'View', 'buddypress' ),
    187187                'href'   => trailingslashit( $profile_link . 'public' )
    188188            );
     
    191191            $wp_admin_nav[] = array(
    192192                'parent' => 'my-account-' . $this->id,
    193                 'title'  => __( 'Edit My Profile', 'buddypress' ),
     193                'title'  => __( 'Edit', 'buddypress' ),
    194194                'href'   => trailingslashit( $profile_link . 'edit' )
    195195            );
     
    198198            $wp_admin_nav[] = array(
    199199                'parent' => 'my-account-' . $this->id,
    200                 'title'  => __( 'Change My Avatar', 'buddypress' ),
     200                'title'  => __( 'Change Avatar', 'buddypress' ),
    201201                'href'   => trailingslashit( $profile_link . 'change-avatar' )
    202202            );
Note: See TracChangeset for help on using the changeset viewer.