bbp_get_user_topic_count_raw( $user_id )

Return the raw database count of topics by a user

Description

Return

(int) Raw DB count of topics

Source

File: bp-forums/users/functions.php

144
145
146
147
148
149
150
151
152
153
154
155
function bbp_get_user_topic_count_raw( $user_id = 0 ) {
    $user_id = bbp_get_user_id( $user_id );
    if ( empty( $user_id ) )
        return false;
 
    global $wpdb;
 
    $where = get_posts_by_author_sql( bbp_get_topic_post_type(), true, $user_id );
    $count = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} {$where}" );
 
    return (int) apply_filters( 'bbp_get_user_topic_count_raw', $count, $user_id );
}

Changelog

Changelog
Version Description
bbPress (r3633) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.