bbp_update_topic_voice_count

  • apply_filters( 'bbp_update_topic_voice_count', (int) $voices, $topic_id )

    Source Reference:

    • Component: bbPress :: bbp-topic
      File: /bbp-includes/bbp-topic-functions.php :: Trac Source Line: 2293
      	// Query the DB to get voices in this topic
      	$voices = $wpdb->get_col( $wpdb->prepare( "SELECT COUNT( DISTINCT post_author ) FROM {$wpdb->posts} WHERE ( post_parent = %d AND post_status = '%s' AND post_type = '%s' ) OR ( ID = %d AND post_type = '%s' );", $topic_id, bbp_get_public_status_id(), bbp_get_reply_post_type(), $topic_id, bbp_get_topic_post_type() ) );
      
      	// If there's an error, make sure we at least have 1 voice
      	$voices = ( empty( $voices ) || is_wp_error( $voices ) ) ? 1 : $voices[0];
      
      	// Update the voice count for this topic id
      	update_post_meta( $topic_id, '_bbp_voice_count', (int) $voices );
      
      	return apply_filters( 'bbp_update_topic_voice_count', (int) $voices, $topic_id );
      }
      
      /**
       * Adjust the total anonymous reply count of a topic
       *
       * @since bbPress (r2567)
       *
       * @param int $topic_id Optional. Topic id to update
       * @uses bbp_is_reply() To check if the passed topic id is a reply
       * @uses bbp_get_reply_topic_id() To get the reply topic id
      

Comments are closed.