Skip to:
Content

BuddyPress.org

Changeset 4959


Ignore:
Timestamp:
08/09/2011 08:11:13 PM (15 years ago)
Author:
djpaul
Message:

When recording activity items for comments, check that the post object is a standard WordPress Post. Fixes #3455, props sbrajesh for initial patch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs/bp-blogs-functions.php

    r4907 r4959  
    206206 * password protected.
    207207 *
    208  * @global object $wpdb
    209208 * @global $bp $bp
    210209 * @param int $comment_id
     
    213212 */
    214213function bp_blogs_record_comment( $comment_id, $is_approved = true ) {
    215         global $wpdb, $bp;
     214        global $bp;
    216215
    217216        // Get the users comment
     
    235234
    236235        // Get blog and post data
    237         $blog_id                = (int)$wpdb->blogid;
     236        $blog_id                = get_current_blog_id();
    238237        $recorded_comment->post = get_post( $recorded_comment->comment_post_ID );
     238
     239        if ( empty( $recorded_comment->post ) || is_wp_error( $recorded_comment->post ) )
     240                return false;
    239241
    240242        // If this is a password protected post, don't record the comment
    241243        if ( !empty( $recorded_comment->post->post_password ) )
     244                return false;
     245
     246        // Don't record activity if the comment's associated post isn't a WordPress Post
     247        if ( 'post' != $recorded_comment->post->post_type )
    242248                return false;
    243249
Note: See TracChangeset for help on using the changeset viewer.