Skip to:
Content

BuddyPress.org

Changeset 3153


Ignore:
Timestamp:
08/01/2010 10:48:30 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Fixes #2513 and code cleanup to bp_blogs_record_comment function

File:
1 edited

Legend:

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

    r3143 r3153  
    440440 * @global object $wpdb
    441441 * @global $bp $bp
    442  * @param <type> $comment_id
    443  * @param <type> $is_approved
    444  * @return <type>
     442 * @param int $comment_id
     443 * @param bool $is_approved
     444 * @return mixed
    445445 */
     446
    446447function bp_blogs_record_comment( $comment_id, $is_approved = true ) {
    447448    global $wpdb, $bp;
     
    451452
    452453    // Don't record activity if the comment hasn't been approved
    453     if ( !$is_approved || true != $recorded_comment->comment_approved )
     454    if ( !$is_approved || !$recorded_comment->comment_approved )
    454455        return false;
    455456
     
    463464
    464465    // If there's no registered user id, don't record activity
    465     if ( !$user_id )
     466    if ( empty( $user_id ) )
    466467        return false;
    467468
     
    474475
    475476        // Get activity related links
    476         $post_permalink     = get_permalink( $recorded_comment->comment_post_ID );
    477         $comment_link       = htmlspecialchars( get_comment_link( $recorded_comment->comment_ID ) );
     477        $post_permalink = get_permalink( $recorded_comment->comment_post_ID );
     478        $comment_link   = htmlspecialchars( get_comment_link( $recorded_comment->comment_ID ) );
    478479
    479480        // Prepare to record in activity streams
    480         $activity_action    = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . $post_permalink . '">' . $recorded_comment->post->post_title . '</a>' );
     481        $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>' );
    481482        $activity_content   = $recorded_comment->comment_content;
    482483
    483484        // Record in activity streams
    484485        bp_blogs_record_activity( array(
    485             'user_id'           => $user_id,
    486             'action'            => apply_filters( 'bp_blogs_activity_new_comment_action', $activity_action, &$recorded_comment, $comment_link ),
    487             'content'           => apply_filters( 'bp_blogs_activity_new_comment_content', $activity_content, &$recorded_comment, $comment_link ),
    488             'primary_link'      => apply_filters( 'bp_blogs_activity_new_comment_primary_link', $comment_link, &$recorded_comment ),
    489             'type'              => 'new_blog_comment',
    490             'item_id'           => $blog_id,
    491             'secondary_item_id' => $comment_id,
    492             'recorded_time'     => $recorded_comment->comment_date_gmt
     486            'user_id'           => $user_id,
     487            'action'            => apply_filters( 'bp_blogs_activity_new_comment_action', $activity_action, &$recorded_comment, $comment_link ),
     488            'content'           => apply_filters( 'bp_blogs_activity_new_comment_content', $activity_content, &$recorded_comment, $comment_link ),
     489            'primary_link'      => apply_filters( 'bp_blogs_activity_new_comment_primary_link', $comment_link, &$recorded_comment ),
     490            'type'              => 'new_blog_comment',
     491            'item_id'           => $blog_id,
     492            'secondary_item_id' => $comment_id,
     493            'recorded_time'     => $recorded_comment->comment_date_gmt
    493494        ) );
    494495
Note: See TracChangeset for help on using the changeset viewer.