bbPress: Post Count and Join Date Under Forum Authors
Shows how many posts each member has made and when they joined under their name in forum topics and replies.
Opens WPIDE on
Code
if ( ! function_exists( 'bbp_get_reply_author_id' ) ) {
return;
}
add_action( 'bbp_theme_after_reply_author_details', function () {
$user_id = (int) bbp_get_reply_author_id();
if ( ! $user_id ) {
return;
}
$user = get_userdata( $user_id );
$posts = (int) bbp_get_user_topic_count( $user_id, true ) + (int) bbp_get_user_reply_count( $user_id, true );
printf(
'<div class="wpide-bbp-author-meta" style="font-size:.85em;margin-top:.3em">%1$s<br>%2$s</div>',
esc_html( sprintf( _n( '%s post', '%s posts', $posts ), number_format_i18n( $posts ) ) ),
$user ? esc_html( sprintf( 'Joined %s', wp_date( 'M Y', strtotime( $user->user_registered . ' UTC' ) ) ) ) : ''
);
} );
Notes
Counts come from bbPress's own cached totals, so this adds no heavy queries.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.