Changeset 6534 for trunk/src/includes/users/engagements.php
- Timestamp:
- 06/12/2017 09:23:32 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/users/engagements.php
r6529 r6534 196 196 $topic_id = bbp_get_topic_id( $topic_id ); 197 197 $bbp_db = bbp_db(); 198 $statii = "'" . implode( "', '", bbp_get_public_topic_statuses() ) . "'"; 198 199 199 200 // A cool UNION query! … … 201 202 SELECT DISTINCT( post_author ) FROM ( 202 203 SELECT post_author FROM {$bbp_db->posts} 203 WHERE ( ID = %d AND post_ type = %s )204 WHERE ( ID = %d AND post_status IN ({$statii}) AND post_type = %s ) 204 205 UNION 205 206 SELECT post_author FROM {$bbp_db->posts} 206 WHERE ( post_parent = %d AND post_ type = %s )207 WHERE ( post_parent = %d AND post_status = %s AND post_type = %s ) 207 208 ) as u1"; 208 209 209 210 // Prepare & get results 210 $query = $bbp_db->prepare( $sql, $topic_id, bbp_get_topic_post_type(), $topic_id, bbp_get_ reply_post_type() );211 $query = $bbp_db->prepare( $sql, $topic_id, bbp_get_topic_post_type(), $topic_id, bbp_get_public_status_id(), bbp_get_reply_post_type() ); 211 212 $results = $bbp_db->get_col( $query ); 212 213 … … 439 440 function bbp_update_topic_engagements( $topic_id = 0 ) { 440 441 441 // Check post type442 // Is a reply 442 443 if ( bbp_is_reply( $topic_id ) ) { 444 445 // Bail if reply isn't published 446 if ( ! bbp_is_reply_published( $topic_id ) ) { 447 return; 448 } 449 443 450 $author_id = bbp_get_reply_author_id( $topic_id ); 444 451 $topic_id = bbp_get_reply_topic_id( $topic_id ); 452 453 // Is a topic 445 454 } elseif ( bbp_is_topic( $topic_id ) ) { 446 455 $author_id = bbp_get_topic_author_id( $topic_id ); 447 456 $topic_id = bbp_get_topic_id( $topic_id ); 457 458 // Is unknown 448 459 } else { 460 return; 461 } 462 463 // Bail if topic is not public 464 if ( ! bbp_is_topic_public( $topic_id ) ) { 449 465 return; 450 466 }
Note: See TracChangeset
for help on using the changeset viewer.