Skip to:
Content

BuddyPress.org

Changeset 1979


Ignore:
Timestamp:
09/28/2009 08:48:50 PM (15 years ago)
Author:
apeatling
Message:

Comment recording tweaks and fixes, fixes #1074

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs.php

    r1905 r1979  
    475475add_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 );
    476476
    477 function bp_blogs_approve_comment( $comment_id, $comment ) {
     477function bp_blogs_approve_comment( $comment_id, $comment_status ) {
    478478    global $bp, $wpdb;
     479   
     480    if ( 'approve' != $comment_status )
     481        return false;
    479482
    480483    $recorded_comment = bp_blogs_record_comment( $comment_id, true );
     
    484487    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' ) );
    485488
    486     $comment_link = bp_post_get_permalink( $comment->post, $comment->blog_id );
    487     $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>' );           
    488     $content .= '<blockquote>' . bp_create_excerpt( $comment->comment_content ) . '</blockquote>';
     489    $comment_link = bp_post_get_permalink( $comment->post, $recorded_comment->blog_id );
     490    $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>' );           
     491    $activity_content .= '<blockquote>' . bp_create_excerpt( $comment->comment_content ) . '</blockquote>';
    489492
    490493    /* Record this in activity streams */
     
    499502    ) );
    500503}
    501 add_action( 'comment_approved_', 'bp_blogs_approve_comment', 10, 2 );
    502 
    503 function bp_blogs_unapprove_comment( $comment_id, $status = false ) {
    504     if ( 'spam' == $status || !$status )
     504add_action( 'wp_set_comment_status', 'bp_blogs_approve_comment', 10, 2 );
     505
     506function bp_blogs_unapprove_comment( $comment_id, $comment_status ) {
     507    if ( 'spam' == $comment_status || 'hold' == $comment_status || 'delete' == $comment_status )
    505508        bp_blogs_remove_comment( $comment_id );     
    506509}
    507 add_action( 'comment_unapproved_', 'bp_blogs_unapprove_comment' );
    508510add_action( 'wp_set_comment_status', 'bp_blogs_unapprove_comment', 10, 2 );
    509511
Note: See TracChangeset for help on using the changeset viewer.