Skip to:
Content

BuddyPress.org

Changeset 2209 for trunk/bp-blogs.php


Ignore:
Timestamp:
12/27/2009 10:41:10 AM (14 years ago)
Author:
apeatling
Message:

Single WP support. Yes, you read that correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs.php

    r2179 r2209  
    6565    // On first installation - record all existing blogs in the system.
    6666    if ( !(int)get_site_option( 'bp-blogs-first-install') ) {
    67 
    6867        bp_blogs_record_existing_blogs();
    6968        add_site_option( 'bp-blogs-first-install', 1 );
    70 
    71     } else {
    72 
    73         // Import blog titles and descriptions into the blogmeta table
    74         if ( get_site_option( 'bp-blogs-version' ) <= '0.1.5' ) {
    75             $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM " . $bp->blogs->table_name ) );
    76 
    77             for ( $i = 0; $i < count($blog_ids); $i++ ) {
    78                 $name = get_blog_option( $blog_ids[$i], 'blogname' );
    79                 $desc = get_blog_option( $blog_ids[$i], 'blogdescription' );
    80 
    81                 bp_blogs_update_blogmeta( $blog_ids[$i], 'name', $name );
    82                 bp_blogs_update_blogmeta( $blog_ids[$i], 'description', $desc );
    83                 bp_blogs_update_blogmeta( $blog_ids[$i], 'last_activity', time() );
    84             }
    85         }
    86 
    8769    }
    8870
     
    139121function bp_blogs_setup_nav() {
    140122    global $bp;
     123
     124    /* Blog/post/comment menus should not appear on single WordPress setups. Although comments
     125       and posts made by users will still show on their activity stream .*/
     126    if ( !bp_core_is_multiblog_install() )
     127        return false;
    141128
    142129    /* Add 'Blogs' to the main navigation */
     
    171158    global $bp;
    172159
    173     if ( $bp->current_component == $bp->blogs->slug && empty( $bp->current_action ) ) {
     160    if ( bp_core_is_multiblog_install() && $bp->current_component == $bp->blogs->slug && empty( $bp->current_action ) ) {
    174161        $bp->is_directory = true;
    175162
     
    190177
    191178function bp_blogs_screen_my_blogs() {
     179    global $bp;
     180
     181    if ( !bp_core_is_multiblog_install() )
     182        return false;
     183
    192184    do_action( 'bp_blogs_screen_my_blogs' );
    193185    bp_core_load_template( apply_filters( 'bp_blogs_template_my_blogs', 'members/single/home' ) );
     
    207199    global $bp;
    208200
    209     if ( $bp->current_component != $bp->blogs->slug || 'create' != $bp->current_action )
     201    if ( !bp_core_is_multiblog_install() || $bp->current_component != $bp->blogs->slug || 'create' != $bp->current_action )
    210202        return false;
    211203
     
    379371            bp_blogs_update_blogmeta( $recorded_post->blog_id, 'last_activity', time() );
    380372
    381             if ( (int)get_blog_option( $blog_id, 'blog_public' ) ) {
     373            if ( (int)get_blog_option( $blog_id, 'blog_public' ) || !bp_core_is_multiblog_install() ) {
    382374                /* Record this in activity streams */
    383375                $post_permalink = bp_post_get_permalink( $post, $blog_id );
     
    415407        }
    416408
    417         if ( (int)get_blog_option( $blog_id, 'blog_public' ) ) {
     409        if ( (int)get_blog_option( $blog_id, 'blog_public' ) || !bp_core_is_multiblog_install() ) {
    418410            /* Now re-record the post in the activity streams */
    419411            $post_permalink = bp_post_get_permalink( $post, $blog_id );
     
    469461    bp_blogs_update_blogmeta( $recorded_comment->blog_id, 'last_activity', time() );
    470462
    471     if ( (int)get_blog_option( $recorded_comment->blog_id, 'blog_public' ) ) {
     463    if ( (int)get_blog_option( $recorded_comment->blog_id, 'blog_public' ) || !bp_core_is_multiblog_install() ) {
    472464        /* Record in activity streams */
    473465        $comment_link = bp_post_get_permalink( $comment->post, $recorded_comment->blog_id );
     
    503495    bp_blogs_delete_activity( array( 'item_id' => $comment_id, 'secondary_item_id' => $recorded_comment->blog_id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_comment' ) );
    504496
    505     if ( (int)get_blog_option( $recorded_comment->blog_id, 'blog_public' ) ) {
     497    if ( (int)get_blog_option( $recorded_comment->blog_id, 'blog_public' ) || !bp_core_is_multiblog_install() ) {
    506498        /* Record in activity streams */
    507499        $comment_link = bp_post_get_permalink( $comment->post, $recorded_comment->blog_id );
Note: See TracChangeset for help on using the changeset viewer.