Skip to:
Content

BuddyPress.org

Changeset 3640


Ignore:
Timestamp:
01/01/2011 08:06:28 PM (14 years ago)
Author:
boonebgorges
Message:

Adds the original blog name to the activity action for new blog post/comment activity items on MS. Fixes #2028. Props sorich87

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs.php

    r3627 r3640  
    357357
    358358    // This is to stop infinite loops with Donncha's sitewide tags plugin
    359     if ( (int)$blog_id == (int)$bp->site_options['tags_blog_id'] )
     359    if ( !empty( $bp->site_options['tags_blog_id'] ) && (int)$blog_id == (int)$bp->site_options['tags_blog_id'] )
    360360        return false;
    361361
     
    368368            // Record this in activity streams
    369369            $post_permalink   = get_permalink( $post_id );
    370             $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>' );
     370           
     371            if ( is_multisite() ) {
     372                $activity_action  = sprintf( __( '%s wrote a new blog post: %s on the blog %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>', '<a href="' . get_blog_option( $blog_id, 'home' ) . '">' . get_blog_option( $blog_id, 'blogname' ) . '</a>' );
     373            } else {
     374                $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>' );
     375            }
     376
    371377            $activity_content = $post->post_content;
    372378
     
    386392        bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() );
    387393    } else {
    388         bp_blogs_remove_post( $post_id, $blog_id );
     394        bp_blogs_remove_post( $post_id, $blog_id, $user_id );
    389395    }
    390396
     
    443449
    444450        // Prepare to record in activity streams
    445         $activity_action    = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . $post_permalink . '">' . apply_filters( 'the_title', $recorded_comment->post->post_title ) . '</a>' );
     451        if ( is_multisite() ) {
     452            $activity_action    = sprintf( __( '%s commented on the blog post %s on the blog %s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . $post_permalink . '">' . apply_filters( 'the_title', $recorded_comment->post->post_title ) . '</a>', '<a href="' . get_blog_option( $blog_id, 'home' ) . '">' . get_blog_option( $blog_id, 'blogname' ) . '</a>' );
     453        } else {
     454            $activity_action    = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . $post_permalink . '">' . apply_filters( 'the_title', $recorded_comment->post->post_title ) . '</a>' );
     455        }
     456       
    446457        $activity_content   = $recorded_comment->comment_content;
    447 
     458       
    448459        // Record in activity streams
    449460        bp_blogs_record_activity( array(
     
    538549add_action( 'remove_user_from_blog', 'bp_blogs_remove_blog_for_user', 10, 2 );
    539550
    540 function bp_blogs_remove_post( $post_id, $blog_id = false ) {
     551function bp_blogs_remove_post( $post_id, $blog_id = false, $user_id = false ) {
    541552    global $current_blog, $bp;
    542553
     
    546557        $blog_id = (int)$current_blog->blog_id;
    547558
     559    if ( !$user_id )
     560        $user_id = $bp->loggedin_user->id;
     561
    548562    // Delete activity stream item
    549563    bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'secondary_item_id' => $post_id, 'component' => $bp->blogs->slug, 'type' => 'new_blog_post' ) );
    550564
    551     do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $post->user_id );
     565    do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $user_id );
    552566}
    553567add_action( 'delete_post', 'bp_blogs_remove_post' );
Note: See TracChangeset for help on using the changeset viewer.