bbp_get_user_post_count( int $user_id, boolean $integer = false )

Return a users total post count

Description

Parameters

$user_id

(Required)

$integer

(Optional) Whether or not to format the result

Default value: false

Return

(string)

Source

File: bp-forums/users/options.php

233
234
235
236
237
238
239
240
241
242
243
244
245
246
function bbp_get_user_post_count( $user_id = 0, $integer = false ) {
 
    // Validate user id
    $user_id = bbp_get_user_id( $user_id );
    if ( empty( $user_id ) )
        return false;
 
    $topics  = bbp_get_user_topic_count( $user_id, true );
    $replies = bbp_get_user_reply_count( $user_id, true );
    $count   = (int) $topics + $replies;
    $filter  = ( true === $integer ) ? 'bbp_get_user_post_count_int' : 'bbp_get_user_post_count';
 
    return apply_filters( $filter, $count, $user_id );
}

Changelog

Changelog
Version Description
bbPress (r3632) 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.