Skip to:
Content

BuddyPress.org

Changeset 3419


Ignore:
Timestamp:
11/14/2010 05:28:25 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Fixes #2728 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs.php

    r3417 r3419  
    349349        $user_id = (int)$post->post_author;
    350350
    351     /* This is to stop infinite loops with Donncha's sitewide tags plugin */
    352     if ( (int)$bp->site_options['tags_blog_id'] == (int)$blog_id )
    353         return false;
    354 
    355     /* Don't record this if it's not a post */
    356     if ( $post->post_type != 'post' )
    357         return false;
    358 
    359     if ( 'publish' == $post->post_status && '' == $post->post_password ) {
    360         if ( (int)get_blog_option( $blog_id, 'blog_public' ) || !is_multisite() ) {
    361             /* Record this in activity streams */
    362             $post_permalink = get_permalink( $post_id );
    363 
    364             $activity_action = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
     351    // This is to stop infinite loops with Donncha's sitewide tags plugin
     352    if ( (int)$blog_id == (int)$bp->site_options['tags_blog_id'] )
     353        return false;
     354
     355    // Don't record this if it's not a post
     356    if ( 'post' != $post->post_type )
     357        return false;
     358
     359    if ( 'publish' == $post->post_status && empty( $post->post_password ) ) {
     360        if ( (int)get_blog_option( $blog_id, 'blog_public' ) || !bp_core_is_multisite() ) {
     361            // Record this in activity streams
     362            $post_permalink   = get_permalink( $post_id );
     363            $activity_action  = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
    365364            $activity_content = $post->post_content;
    366365
    367366            bp_blogs_record_activity( array(
    368                 'user_id' => (int)$post->post_author,
    369                 'action' => apply_filters( 'bp_blogs_activity_new_post_action', $activity_action, &$post, $post_permalink ),
    370                 'content' => apply_filters( 'bp_blogs_activity_new_post_content', $activity_content, &$post, $post_permalink ),
    371                 'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
    372                 'type' => 'new_blog_post',
    373                 'item_id' => $blog_id,
     367                'user_id'            => (int)$post->post_author,
     368                'action'            => apply_filters( 'bp_blogs_activity_new_post_action', $activity_action, &$post, $post_permalink ),
     369                'content'           => apply_filters( 'bp_blogs_activity_new_post_content', $activity_content, &$post, $post_permalink ),
     370                'primary_link'      => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
     371                'type'              => 'new_blog_post',
     372                'item_id'           => $blog_id,
    374373                'secondary_item_id' => $post_id,
    375                 'recorded_time' => $post->post_date_gmt
     374                'recorded_time'     => $post->post_date_gmt
    376375            ));
    377376        }
    378     } else
     377
     378        // Update the blogs last activity
     379        bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() );
     380    } else {
    379381        bp_blogs_remove_post( $post_id, $blog_id );
    380 
    381     bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() );
     382    }
    382383
    383384    do_action( 'bp_blogs_new_blog_post', $post_id, $post, $user_id );
Note: See TracChangeset for help on using the changeset viewer.