Changeset 1388 for trunk/bp-blogs/bp-blogs-classes.php
- Timestamp:
- 04/22/2009 06:17:08 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs/bp-blogs-classes.php
r1366 r1388 486 486 var $date_created; 487 487 488 function bp_blogs_comment( $id = null) {488 function bp_blogs_comment( $id = false, $blog_id = false, $comment_id = false ) { 489 489 global $bp, $wpdb; 490 490 … … 492 492 $user_id = $bp->displayed_user->id; 493 493 494 if ( $id ) {494 if ( $id || ( !$id && $blog_id && $comment_id ) ) { 495 495 $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 505 510 $this->comment_id = $comment->comment_id; 506 511 $this->user_id = $comment->user_id;
Note: See TracChangeset
for help on using the changeset viewer.