Changeset 2328
- Timestamp:
- 01/18/2010 11:35:50 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs.php
r2327 r2328 263 263 264 264 function bp_blogs_delete_activity( $args = true ) { 265 global $bp; 266 265 267 if ( function_exists('bp_activity_delete_by_item_id') ) { 266 extract($args); 268 $defaults = array( 269 'item_id' => false, 270 'component_name' => $bp->blogs->id, 271 'component_action' => false, 272 'user_id' => false, 273 'secondary_item_id' => false 274 ); 275 276 $params = wp_parse_args( $args, $defaults ); 277 extract( $params, EXTR_SKIP ); 267 278 268 279 bp_activity_delete_by_item_id( array( … … 424 435 'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ), 425 436 'component_action' => 'new_blog_post', 426 'item_id' => $existing_post->id, 437 'item_id' => $blog_id, 438 'secondary_item_id' => $existing_post->id, 427 439 'recorded_time' => strtotime( $post->post_date_gmt ) 428 440 ) ); … … 490 502 add_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 ); 491 503 492 function bp_blogs_approve_comment( $comment_id, $comment_status ) { 493 global $bp, $wpdb; 494 495 if ( 'approve' != $comment_status ) 496 return false; 497 498 $recorded_comment = bp_blogs_record_comment( $comment_id, true ); 499 $comment = get_comment($comment_id); 500 $comment->post = get_post( $comment->comment_post_ID ); 501 502 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' ) ); 503 504 if ( (int)get_blog_option( $recorded_comment->blog_id, 'blog_public' ) || !bp_core_is_multisite() ) { 505 /* Record in activity streams */ 506 $comment_link = bp_post_get_permalink( $comment->post, $recorded_comment->blog_id ); 507 $activity_content = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $recorded_comment->user_id ), '<a href="' . $comment_link . '#comment-' . $comment->comment_ID . '">' . $comment->post->post_title . '</a>' ); 508 $activity_content .= '<blockquote>' . bp_create_excerpt( $comment->comment_content ) . '</blockquote>'; 509 510 /* Record this in activity streams */ 511 bp_blogs_record_activity( array( 512 'user_id' => $recorded_comment->user_id, 513 'content' => apply_filters( 'bp_blogs_activity_new_comment', $activity_content, &$comment, &$recorded_comment, $comment_link ), 514 'primary_link' => apply_filters( 'bp_blogs_activity_new_comment_primary_link', $comment_link, &$comment, &$recorded_comment ), 515 'component_action' => 'new_blog_comment', 516 'item_id' => $comment_id, 517 'secondary_item_id' => $recorded_comment->blog_id, 518 'recorded_time' => $recorded_comment->date_created 519 ) ); 520 } 521 } 522 add_action( 'wp_set_comment_status', 'bp_blogs_approve_comment', 10, 2 ); 523 524 function bp_blogs_unapprove_comment( $comment_id, $comment_status ) { 525 if ( 'spam' == $comment_status || 'hold' == $comment_status || 'delete' == $comment_status ) 526 bp_blogs_remove_comment( $comment_id ); 527 } 528 add_action( 'wp_set_comment_status', 'bp_blogs_unapprove_comment', 10, 2 ); 504 function bp_blogs_manage_comment( $comment_id, $comment_status ) { 505 if ( 'spam' == $comment_status || 'hold' == $comment_status || 'delete' == $comment_status || 'trash' == $comment_status ) 506 return bp_blogs_remove_comment( $comment_id ); 507 508 return bp_blogs_record_comment( $comment_id, true ); 509 } 510 add_action( 'wp_set_comment_status', 'bp_blogs_manage_comment', 10, 2 ); 529 511 530 512 function bp_blogs_add_user_to_blog( $user_id, $role, $blog_id ) { … … 584 566 585 567 // Delete activity stream item 586 bp_blogs_delete_activity( array( 'item_id' => $ existing_post->id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_post' ) );568 bp_blogs_delete_activity( array( 'item_id' => $wpdb->blogid, 'component_name' => $existing_post->id, 'component_action' => 'new_blog_post' ) ); 587 569 588 570 do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $post->user_id ); … … 597 579 598 580 // Delete activity stream item 599 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' ) );581 bp_blogs_delete_activity( array( 'item_id' => $wpdb->blogid, 'secondary_item_id' => $comment_id, 'component_action' => 'new_blog_comment' ) ); 600 582 601 583 do_action( 'bp_blogs_remove_comment', $blog_id, $comment_id, $bp->loggedin_user->id );
Note: See TracChangeset
for help on using the changeset viewer.