Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/22/2009 06:17:08 PM (17 years ago)
Author:
apeatling
Message:

Fixing problems with blog comment activity stream recording when setting comment status from approved/unapproved/spam.

File:
1 edited

Legend:

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

    r1366 r1388  
    486486        var $date_created;
    487487       
    488         function bp_blogs_comment( $id = null ) {
     488        function bp_blogs_comment( $id = false, $blog_id = false, $comment_id = false ) {
    489489                global $bp, $wpdb;
    490490
     
    492492                        $user_id = $bp->displayed_user->id;
    493493                       
    494                 if ( $id ) {
     494                if ( $id || ( !$id && $blog_id && $comment_id ) ) {
    495495                        $this->id = $id;
    496                         $this->populate( $id );
    497                 }
    498         }
    499 
    500         function populate( $id ) {
    501                 global $wpdb, $bp;
    502                
    503                 $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->blogs->table_name_blog_comments} WHERE id = %d", $this->id ) );
    504 
     496                        $this->blog_id = $blog_id;
     497                        $this->comment_id = $comment_id;
     498                        $this->populate();
     499                }
     500        }
     501
     502        function populate() {
     503                global $wpdb, $bp;
     504               
     505                if ( $this->id )
     506                        $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->blogs->table_name_blog_comments} WHERE id = %d", $this->id ) );
     507                else
     508                        $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->blogs->table_name_blog_comments} WHERE blog_id = %d AND comment_id = %d", (int)$this->blog_id, (int)$this->comment_id ) );
     509               
    505510                $this->comment_id = $comment->comment_id;
    506511                $this->user_id = $comment->user_id;
Note: See TracChangeset for help on using the changeset viewer.