Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/02/2009 06:56:42 PM (17 years ago)
Author:
apeatling
Message:

Merging last few trunk changes and stripping all whitespace.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1/bp-core/bp-core-adminbar.php

    r1905 r2076  
    33function bp_core_admin_bar() {
    44        global $bp, $wpdb, $current_blog, $doing_admin_bar;
    5        
     5
    66        if ( defined( 'BP_DISABLE_ADMIN_BAR' ) )
    77                return false;
    8        
     8
    99        $doing_admin_bar = true;
    10        
     10
    1111        if ( (int)get_site_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() )
    1212                return false;
    … …  
    1818
    1919        echo '<ul class="main-nav">';
    20        
     20
    2121        // **** Do bp-adminbar-menus Actions ********
    2222        do_action( 'bp_adminbar_menus' );
    … …  
    2929function bp_adminbar_logo() {
    3030        global $bp;
    31        
     31
    3232        echo '<a href="' . $bp->root_domain . '" id="admin-bar-logo">' . get_blog_option( BP_ROOT_BLOG, 'blogname') . '</a>';
    3333}
    … …  
    3737        global $bp;
    3838
    39         if ( !is_user_logged_in() ) {   
     39        if ( !is_user_logged_in() ) {
    4040                echo '<li class="bp-login no-arrow"><a href="' . $bp->root_domain . '/wp-login.php?redirect_to=' . urlencode( $bp->root_domain ) . '">' . __( 'Log In', 'buddypress' ) . '</a></li>';
    41                
     41
    4242                // Show "Sign Up" link if user registrations are allowed
    4343                if ( get_site_option( 'registration' ) != 'none' && get_site_option( 'registration' ) != 'blog' ) {
    … …  
    5555
    5656        if ( is_user_logged_in() ) {
    57                
     57
    5858                echo '<li id="bp-adminbar-account-menu"><a href="' . bp_loggedin_user_domain() . '">';
    59        
     59
    6060                echo __( 'My Account', 'buddypress' ) . '</a>';
    6161                echo '<ul>';
    62        
     62
    6363                /* Loop through each navigation item */
    6464                $counter = 0;
    6565                foreach( $bp->bp_nav as $nav_item ) {
    6666                        $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
    67                        
     67
    6868                        echo '<li' . $alt . '>';
    6969                        echo '<a id="bp-admin-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a>';
    70                        
     70
    7171                        if ( is_array( $bp->bp_options_nav[$nav_item['css_id']] ) ) {
    7272                                echo '<ul>';
    … …  
    7575                                foreach( $bp->bp_options_nav[$nav_item['css_id']] as $subnav_item ) {
    7676                                        $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : '';
    77                                         echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>';                               
     77                                        echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>';
    7878                                        $sub_counter++;
    7979                                }
    8080                                echo '</ul>';
    8181                        }
    82                
     82
    8383                        echo '</li>';
    84                        
     84
    8585                        $counter++;
    8686                }
    87        
     87
    8888                $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
    8989
    90                 if ( function_exists('wp_logout_url') ) { 
    91                         echo '<li' . $alt . '><a id="bp-admin-logout" href="' . wp_logout_url(site_url()) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';                   
    92                 } else { 
    93                         echo '<li' . $alt . '><a id="bp-admin-logout" href="' . site_url() . '/wp-login.php?action=logout&amp;redirect_to=' . site_url() . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>'; 
    94                 } 
    95                          
     90                if ( function_exists('wp_logout_url') ) {
     91                        echo '<li' . $alt . '><a id="bp-admin-logout" href="' . wp_logout_url(site_url()) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
     92                } else {
     93                        echo '<li' . $alt . '><a id="bp-admin-logout" href="' . site_url() . '/wp-login.php?action=logout&amp;redirect_to=' . site_url() . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
     94                }
     95
    9696                echo '</ul>';
    9797                echo '</li>';
    … …  
    101101// return a string indicating user's role in that blog
    102102function get_blog_role_for_user( $user, $blog ) {
    103        
     103
    104104        // If the user is a site admin, just display admin.
    105         if ( is_site_admin() ) 
     105        if ( is_site_admin() )
    106106                return __( 'Admin', 'buddypress');
    107        
     107
    108108        $roles = get_usermeta( $user, 'wp_' . $blog . '_capabilities' );
    109109
    110110        if ( isset( $roles['subscriber'] ) )
    111                 $role = __( 'Subscriber', 'buddypress' ); 
     111                $role = __( 'Subscriber', 'buddypress' );
    112112        elseif  ( isset( $roles['contributor'] ) )
    113113                $role = __( 'Contributor', 'buddypress' );
    … …  
    120120        else
    121121                return false;
    122        
     122
    123123        return $role;
    124124}
    … …  
    127127function bp_adminbar_blogs_menu() {
    128128        if ( is_user_logged_in() ) {
    129                 global $bp; 
    130        
     129                global $bp;
     130
    131131                if ( function_exists('bp_blogs_install') ) {
    132                        
     132
    133133                        if ( !$blogs = wp_cache_get( 'bp_blogs_of_user_' . $bp->loggedin_user->id, 'bp' ) ) {
    134134                                $blogs = get_blogs_of_user( $bp->loggedin_user->id );
    … …  
    137137
    138138                        echo '<li id="bp-adminbar-blogs-menu"><a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/my-blogs">';
    139                        
     139
    140140                        _e( 'My Blogs', 'buddypress' );
    141                        
     141
    142142                        echo '</a>';
    143        
    144                         echo '<ul>';                   
     143
     144                        echo '<ul>';
    145145                        if ( is_array( $blogs )) {
    146                
     146
    147147                                $counter = 0;
    148148                                foreach( $blogs as $blog ) {
    … …  
    157157                                                echo '<li><a href="' . $blog->siteurl  . '/wp-admin/post-new.php">' . __('New Post', 'buddypress') . '</a></li>';
    158158                                                echo '<li class="alt"><a href="' . $blog->siteurl  . '/wp-admin/edit.php">' . __('Manage Posts', 'buddypress') . '</a></li>';
    159                                                 echo '<li><a href="' . $blog->siteurl  . '/wp-admin/edit-comments.php">' . __('Manage Comments', 'buddypress') . '</a></li>';                                   
    160                                                 if ( 'Admin' == $role ) {       
    161                                                         echo '<li class="alt"><a href="' . $blog->siteurl  . '/wp-admin/themes.php">' . __('Switch Theme', 'buddypress') . '</a></li>'; 
    162                                                 }                                       
    163                                                 echo '</ul>';                                   
     159                                                echo '<li><a href="' . $blog->siteurl  . '/wp-admin/edit-comments.php">' . __('Manage Comments', 'buddypress') . '</a></li>';
     160                                                if ( 'Admin' == $role ) {
     161                                                        echo '<li class="alt"><a href="' . $blog->siteurl  . '/wp-admin/themes.php">' . __('Switch Theme', 'buddypress') . '</a></li>';
     162                                                }
     163                                                echo '</ul>';
    164164                                        }
    165165                                        echo '</li>';
    … …  
    167167                                }
    168168                        }
    169        
     169
    170170                        $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
    171                        
     171
    172172                        if ( bp_blog_signup_enabled() ) {
    173173                                echo '<li' . $alt . '>';
    … …  
    175175                                echo '</li>';
    176176                        }
    177                        
     177
    178178                        echo '</ul>';
    179179                        echo '</li>';
    180180                }
    181181        }
    182 }       
     182}
    183183
    184184// **** "Notifications" Menu *********
    185 function bp_adminbar_notifications_menu() {     
     185function bp_adminbar_notifications_menu() {
    186186        if ( is_user_logged_in() ) {
    187187                global $bp;
    188                
     188
    189189                echo '<li id="bp-adminbar-notifications-menu"><a href="' . $bp->loggedin_user->domain . '">';
    190190                _e( 'Notifications', 'buddypress' );
    191        
     191
    192192                if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
    193193                        <span><?php echo count($notifications) ?></span>
    194194                <?php
    195195                }
    196                
     196
    197197                echo '</a>';
    198198                echo '<ul>';
    199                
     199
    200200                if ( $notifications ) { ?>
    201201                        <?php $counter = 0; ?>
    … …  
    209209                <?php
    210210                }
    211                
     211
    212212                echo '</ul>';
    213213                echo '</li>';
    … …  
    218218function bp_adminbar_authors_menu() {
    219219        global $current_blog;
    220        
     220
    221221        if ( $current_blog->blog_id > 1 ) {
    222                 $authors = get_users_of_blog(); 
    223        
     222                $authors = get_users_of_blog();
     223
    224224                if ( is_array( $authors ) ) {
    225225                        /* This is a blog, render a menu with links to all authors */
    … …  
    227227                        _e('Blog Authors', 'buddypress');
    228228                        echo '</a>';
    229                
     229
    230230                        echo '<ul class="author-list">';
    231231                        foreach( $authors as $author ) {
    … …  
    246246        }
    247247}
    248        
     248
    249249// **** "Random" Menu (visible when not logged in) ********
    250 function bp_adminbar_random_menu() { 
     250function bp_adminbar_random_menu() {
    251251        global $bp; ?>
    252252        <li class="align-right" id="bp-adminbar-visitrandom-menu">
    … …  
    261261                        <?php if ( function_exists('bp_blogs_install') ) : ?>
    262262                        <li><a href="<?php echo $bp->root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li>
    263                        
     263
    264264                        <?php endif; ?>
    265                        
     265
    266266                        <?php do_action( 'bp_adminbar_random_menu' ) ?>
    267267                </ul>
Note: See TracChangeset for help on using the changeset viewer.