Skip to:
Content
Pages
Categories
Search
Top
Bottom

Post count functions broken


  • Loc Pham
    Participant

    @phamdacloc

    Are these three functions broken because I’m receiving zero posts/topics/replies when they’re executed:

    bbp_get_user_post_count()
    bbp_get_user_reply_count()
    bbp_get_user_topic_count()
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Loc Pham, welcome back.

    No they are not broken, otherwise over 200.000 others would have complained already.

    Are you giving the user_id as an integer as parameter ?
    Are you always getting 0 or you are not getting the correct result ?

    Pascal.


    Loc Pham
    Participant

    @phamdacloc

    Hi Pascal,
    Yes, I passed in the user id for admin and I’ve always got “0” back and admin had created many topics already.

    bbp_get_user_post_count(1, false);

    Thanks.


    Robkk
    Moderator

    @robkk

    It works for me if I passed the reply/topic post author’s ID, it doesn’t update immediately though. Running the repair tools for calculating each users counts one by one in Tools > Forums fixed that.

    I think auto-updating the count is part of the latest dev version though.

    Here is the code I used to test it very quick. I just placed this in loop-single-reply.php.

    <?php print bbp_get_user_reply_count( bbp_get_reply_author_id() ) ?>


    Loc Pham
    Participant

    @phamdacloc

    Repairing the counter via Tools menu did the trick. Thank you for your help.


    arnalyse
    Participant

    @arnalyse

    I encountered the same Problem as Loc: The count returned by bbp_get_user_reply_count does not update with the user’s activities in the forums. The bbp_get_user_reply_count_raw computes the count directly from the database, which is computationally more expensive, but delivers a correct count.

    Furthermore Robkk is right: I just had a look at the source code of bbPress 2.6-alpha, and has added and hooked some functions to correctly increase and decrease the post count on user’s actions such as creating and deleting posts.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar