Skip to:
Content

BuddyPress.org

Ticket #1251: remove-create-blog-link.patch

File remove-create-blog-link.patch, 3.1 KB (added by boonebgorges, 15 years ago)
  • bp-themes/bp-sn-parent/blogs/my-blogs.php

     
    3232                <?php else: ?>
    3333
    3434                        <div id="message" class="info">
    35                                 <p><?php bp_word_or_name( __( "You haven't created any blogs yet.", 'buddypress' ), __( "%s hasn't created any public blogs yet.", 'buddypress' ) ) ?> <?php bp_create_blog_link() ?> </p>
     35                                <p><?php bp_word_or_name( __( "You haven't created any blogs yet.", 'buddypress' ), __( "%s hasn't created any public blogs yet.", 'buddypress' ) ) ?> <?php if ( bp_can_create_blogs()) bp_create_blog_link() ?> </p>
    3636                        </div>
    3737
    3838                <?php endif;?>
  • bp-blogs.php

     
    131131}
    132132add_action( 'plugins_loaded', 'bp_blogs_setup_root_component', 2 );
    133133
     134function bp_can_create_blogs() {       
     135        $active_signup = get_site_option( 'registration' );
     136        if( !$active_signup )
     137                $active_signup = 'all';
     138
     139        $active_signup = apply_filters( 'wpmu_active_signup', $active_signup );
     140       
     141        if ( is_site_admin() )
     142                return true;
     143        if ( ( $active_signup == 'blog' || $active_signup == 'all' ) && is_user_logged_in() )
     144                return true;
     145               
     146        return false;
     147}
     148 
    134149/**
    135150 * bp_blogs_setup_nav()
    136151 *
     
    142157 */
    143158function bp_blogs_setup_nav() {
    144159        global $bp;
    145        
     160
    146161        /* Add 'Blogs' to the main navigation */
    147162        bp_core_new_nav_item( array( 'name' => __( 'Blogs', 'buddypress' ), 'slug' => $bp->blogs->slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-blogs', 'item_css_id' => $bp->blogs->id ) );
    148163       
     
    152167        bp_core_new_subnav_item( array( 'name' => __( 'My Blogs', 'buddypress' ), 'slug' => 'my-blogs', 'parent_url' => $blogs_link, 'parent_slug' => $bp->blogs->slug, 'screen_function' => 'bp_blogs_screen_my_blogs', 'position' => 10, 'item_css_id' => 'my-blogs-list' ) );
    153168        bp_core_new_subnav_item( array( 'name' => __( 'Recent Posts', 'buddypress' ), 'slug' => 'recent-posts', 'parent_url' => $blogs_link, 'parent_slug' => $bp->blogs->slug, 'screen_function' => 'bp_blogs_screen_recent_posts', 'position' => 20 ) );
    154169        bp_core_new_subnav_item( array( 'name' => __( 'Recent Comments', 'buddypress' ), 'slug' => 'recent-comments', 'parent_url' => $blogs_link, 'parent_slug' => $bp->blogs->slug, 'screen_function' => 'bp_blogs_screen_recent_comments', 'position' => 30 ) );
    155         bp_core_new_subnav_item( array( 'name' => __( 'Create a Blog', 'buddypress' ), 'slug' => 'create-a-blog', 'parent_url' => $blogs_link, 'parent_slug' => $bp->blogs->slug, 'screen_function' => 'bp_blogs_screen_create_a_blog', 'position' => 40 ) );
     170        if ( bp_can_create_blogs() )
     171                bp_core_new_subnav_item( array( 'name' => __( 'Create a Blog', 'buddypress' ), 'slug' => 'create-a-blog', 'parent_url' => $blogs_link, 'parent_slug' => $bp->blogs->slug, 'screen_function' => 'bp_blogs_screen_create_a_blog', 'position' => 40 ) );
    156172
    157173        /* Set up the component options navigation for Blog */
    158174        if ( 'blogs' == $bp->current_component ) {