Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/27/2011 03:40:28 PM (14 years ago)
Author:
johnjamesjacoby
Message:

If no blogs for user can be found or bp_blogs_get_blogs_for_user fails, do not show an empty blogs menu.

File:
1 edited

Legend:

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

    r3937 r3951  
    413413    }
    414414
    415     echo '<li id="bp-adminbar-blogs-menu"><a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/">';
    416 
    417     _e( 'My Blogs', 'buddypress' );
    418 
    419     echo '</a>';
    420     echo '<ul>';
    421 
    422415    $counter = 0;
    423416    if ( is_array( $blogs['blogs'] ) && (int)$blogs['count'] ) {
     417
     418        echo '<li id="bp-adminbar-blogs-menu"><a href="' . trailingslashit( $bp->loggedin_user->domain . $bp->blogs->slug ) . '">';
     419
     420        _e( 'My Blogs', 'buddypress' );
     421
     422        echo '</a>';
     423        echo '<ul>';
     424
    424425        foreach ( (array)$blogs['blogs'] as $blog ) {
    425             $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
     426            $alt      = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
    426427            $site_url = esc_attr( $blog->siteurl );
    427428
     
    440441            $counter++;
    441442        }
    442     }
    443 
    444     $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
    445 
    446     if ( bp_blog_signup_enabled() ) {
    447         echo '<li' . $alt . '>';
    448         echo '<a href="' . $bp->root_domain . '/' . $bp->blogs->root_slug . '/create/">' . __( 'Create a Blog!', 'buddypress' ) . '</a>';
     443
     444        $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
     445
     446        if ( bp_blog_signup_enabled() ) {
     447            echo '<li' . $alt . '>';
     448            echo '<a href="' . $bp->root_domain . '/' . $bp->blogs->root_slug . '/create/">' . __( 'Create a Blog!', 'buddypress' ) . '</a>';
     449            echo '</li>';
     450        }
     451
     452        echo '</ul>';
    449453        echo '</li>';
    450454    }
    451 
    452     echo '</ul>';
    453     echo '</li>';
    454455}
    455456
Note: See TracChangeset for help on using the changeset viewer.