bbp_get_user_topic_count_raw( int $user_id )
Return the raw database count of topics by a user
Description Description
Parameters Parameters
- $user_id
-
(Required) User ID to get count for
Return Return
(int) Raw DB count of topics
Source Source
File: includes/users/functions.php
function bbp_get_user_topic_count_raw( $user_id = 0 ) { $user_id = bbp_get_user_id( $user_id ); $bbp_db = bbp_db(); $statii = "'" . implode( "', '", bbp_get_public_topic_statuses() ) . "'"; $sql = "SELECT COUNT(*) FROM {$bbp_db->posts} WHERE post_author = %d AND post_type = %s AND post_status IN ({$statii})"; $query = $bbp_db->prepare( $sql, $user_id, bbp_get_topic_post_type() ); $count = (int) $bbp_db->get_var( $query ); // Filter & return return (int) apply_filters( 'bbp_get_user_topic_count_raw', $count, $user_id ); }
Changelog Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |