Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/14/2010 05:27:12 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Fixes #2728 (branch)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-blogs.php

    r3416 r3418  
    408408        $user_id = (int)$post->post_author;
    409409
    410     /* This is to stop infinite loops with Donncha's sitewide tags plugin */
    411     if ( (int)$bp->site_options['tags_blog_id'] == (int)$blog_id )
    412         return false;
    413 
    414     /* Don't record this if it's not a post */
    415     if ( $post->post_type != 'post' )
    416         return false;
    417 
    418     if ( 'publish' == $post->post_status && '' == $post->post_password ) {
     410    // This is to stop infinite loops with Donncha's sitewide tags plugin
     411    if ( (int)$blog_id == (int)$bp->site_options['tags_blog_id'] )
     412        return false;
     413
     414    // Don't record this if it's not a post
     415    if ( 'post' != $post->post_type )
     416        return false;
     417
     418    if ( 'publish' == $post->post_status && empty( $post->post_password ) ) {
    419419        if ( (int)get_blog_option( $blog_id, 'blog_public' ) || !bp_core_is_multisite() ) {
    420             /* Record this in activity streams */
    421             $post_permalink = get_permalink( $post_id );
    422 
    423             $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>' );
     420            // Record this in activity streams
     421            $post_permalink   = get_permalink( $post_id );
     422            $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>' );
    424423            $activity_content = $post->post_content;
    425424
    426425            bp_blogs_record_activity( array(
    427                 'user_id' => (int)$post->post_author,
    428                 'action' => apply_filters( 'bp_blogs_activity_new_post_action', $activity_action, &$post, $post_permalink ),
    429                 'content' => apply_filters( 'bp_blogs_activity_new_post_content', $activity_content, &$post, $post_permalink ),
    430                 'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
    431                 'type' => 'new_blog_post',
    432                 'item_id' => $blog_id,
     426                'user_id'            => (int)$post->post_author,
     427                'action'            => apply_filters( 'bp_blogs_activity_new_post_action', $activity_action, &$post, $post_permalink ),
     428                'content'           => apply_filters( 'bp_blogs_activity_new_post_content', $activity_content, &$post, $post_permalink ),
     429                'primary_link'      => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
     430                'type'              => 'new_blog_post',
     431                'item_id'           => $blog_id,
    433432                'secondary_item_id' => $post_id,
    434                 'recorded_time' => $post->post_date_gmt
     433                'recorded_time'     => $post->post_date_gmt
    435434            ));
    436435        }
    437     } else
     436
     437        // Update the blogs last activity
     438        bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() );
     439    } else {
    438440        bp_blogs_remove_post( $post_id, $blog_id );
    439 
    440     bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() );
     441    }
    441442
    442443    do_action( 'bp_blogs_new_blog_post', $post_id, $post, $user_id );
Note: See TracChangeset for help on using the changeset viewer.