Skip to:
Content
Pages
Categories
Search
Top
Bottom

List user post total

  • @comagnum

    Participant

    I’ve searched everywhere, to no avail. There used to be a plugin for this for older versions of bbpress (post count pro I believe it was called) but there aren’t any plugins for this anymore. I’m limited on my code knowledge, but I’d really like for this to be accheived. We’re a compeitive gaming community and vBulletin has been a staple of our professional/amateur gaming life since the beginning. I’ve decided to make the move to bbpress to have a more seemless site integration between users, posts, and news. My ultimate goal is to make the forums as similar to vBulletin as possible, but all of the plugins that accheived this goal do not work with the newer versions. I’d like for the post total to be listed under the users name when they post, as well as in their profiles. In addition custom user roles would be a plus, but not requred. If anyone can point me in the right direction, I’d be very grateful.

Viewing 10 replies - 1 through 10 (of 10 total)
  • @comagnum

    Participant

    🙁

    @lynqoid

    Participant

    Give this a try:

    $post_count = ( bbp_get_user_reply_count_raw ( bbp_get_reply_author_id ( bbp_get_reply_id() ) ) ) + ( bbp_get_user_topic_count_raw ( bbp_get_reply_author_id ( bbp_get_reply_id() ) ) );
    		echo "Total Posts: " . $post_count;

    @ronthai

    Participant

    any idea where to add the code to have it show under the avatar in topics/replies?

    I think the count works, just can not get it placed correctly

    @lynqoid

    Participant

    It needs to go inside loop-single-reply.php – just underneath bbp_reply_author_link line 36 in my theme.

    @ronthai

    Participant

    Thanks, any idea how to have it not show under guest posts, since that is not counted of course.

    @lynqoid

    Participant

    You could check what number is returned or if it’s not empty, what does it return for guest users?

    @ronthai

    Participant

    It doesn’t return any number for guests, just “Total posts:”

    @netweb

    Keymaster

    Try bbp_is_anonymous to check if it’s an anonymous user before outputting the post count.

    @ronthai

    Participant

    Nope, that does not seem to be working.
    I tried several different ways, but all just output the same.

    I got to this code, but still outputs the Totals for guests without a value/number:

    <?php if ( bbp_is_anonymous() ) {
    		echo "Guest Post"; }
    		else {
    		$post_count = ( bbp_get_user_topic_count_raw ( bbp_get_reply_author_id ( bbp_get_reply_id() ) ) );
    		echo "Total Topics: " . $post_count; 	
    		$post_count = ( bbp_get_user_reply_count_raw ( bbp_get_reply_author_id ( bbp_get_reply_id() ) ) );
    		echo "Total Replies: " . $post_count; } ?>

    @ronthai

    Participant

    I got it working and also Guests Posts (Topics and Replies) don’t return and empty value.
    Might not be the best way, but all I got:

    <?php 
    		if ( bbp_is_topic_anonymous() ) {
    		echo "<br>Guest Post"; }
    		elseif ( bbp_is_reply_anonymous() ) {
    		echo "<br>Guest Post"; }
    		else {
    		$post_count = ( bbp_get_user_topic_count_raw ( bbp_get_reply_author_id ( bbp_get_reply_id() ) ) );
    		echo "<br>Total Topics: " . $post_count; 	
    		$post_count = ( bbp_get_user_reply_count_raw ( bbp_get_reply_author_id ( bbp_get_reply_id() ) ) );
    		echo "<br>Total Replies: " . $post_count; } 
    ?>
Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Skip to toolbar