Changeset 3128
- Timestamp:
- 05/10/2011 03:23:35 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-topic-functions.php
r3125 r3128 1733 1733 return; 1734 1734 1735 // There should always be at least 1 voice 1736 if ( !$voices = $wpdb->get_col( $wpdb->prepare( "SELECT COUNT( DISTINCT post_author ) FROM {$wpdb->posts} WHERE ( post_parent = %d AND post_status = 'publish' AND post_type = '%s' ) OR ( ID = %d AND post_type = '%s' );", $topic_id, bbp_get_reply_post_type(), $topic_id, bbp_get_topic_post_type() ) ) ) 1737 $voices = 1; 1738 1735 // Query the DB to get voices in this topic 1736 $voices = $wpdb->get_col( $wpdb->prepare( "SELECT COUNT( DISTINCT post_author ) FROM {$wpdb->posts} WHERE ( post_parent = %d AND post_status = 'publish' AND post_type = '%s' ) OR ( ID = %d AND post_type = '%s' );", $topic_id, bbp_get_reply_post_type(), $topic_id, bbp_get_topic_post_type() ) ); 1737 1738 // If there's an error, make sure we at least have 1 voice 1739 $voices = ( empty( $voices ) || is_wp_error( $voices )) ? 1 : $voices[0]; 1740 1741 // Update the voice count for this topic id 1739 1742 update_post_meta( $topic_id, '_bbp_voice_count', (int) $voices ); 1740 1743
Note: See TracChangeset
for help on using the changeset viewer.