Skip to:
Content
Pages
Categories
Search
Top
Bottom

Topics with more than 1000 replies not showing page numbers


  • matrixd
    Participant

    @matrixd

    Hello,

    our BBpress forum has a strange problem, where it does not show the page links for a topic when it has more than 1000 replies. As a result, our users can see only the first page of the topic.

    The problem occurs only in topics with more than 1000 replies. Topics with less than 1000 replies display the page links normally.
    (as you can see in the attached screenshot (the forum is in Greek), topics with less than 1000 replies are OK. Topic with more than 1000 replies do not display page links)

    We have verified that all the replies exist in the database but for some reason BBpress does not “find” them.

    We have used all the forum repair tools in our wp-admin->Forums but it did not fix the problem and we don’t know what else to do to fix it.

    Any help would be highly appreciated.

    Thanks

    Screenshot: http://i.imgur.com/57m72.png

Viewing 10 replies - 1 through 10 (of 10 total)
  • I’m sure this won’t help, but just out of curiosity are you on the latest version of WordPress/bbPress?


    zaerl
    Participant

    @zaerl

    It’s quite strange. I forced 1.000.000 on bbp_get_topic_pagination with no luck. A “find . -name ‘*.php’ | xargs grep 1000″ didn’t show the value hardcoded anywhere.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    My guess is the number is being formatted when it shouldn’t be, putting a comma after the 1, resulting in a string where it’s expecting an integer.


    matrixd
    Participant

    @matrixd

    Hello John, thank you for your reply. It sounds logical that this could be the reason, but we can’t find an option to change the number format (for example from 2,033 to 2033). We have searched all the options in BBpress and WordPress but we could not find it.

    Could you give us more info, how to change it?

    Thank you in advance.

    • This reply was modified 1 year, 11 months ago by  matrixd.

    matrixd
    Participant

    @matrixd

    Hello again, finally after John’s helpful tip, I was able to fix the issue. I found where BBpress does the number formatting and disabled it. In wp-content/plugins/bbpress/bbp-includes/bbp-common-functions.php I changed this line:

    function bbp_number_format( $number = 0, $decimals = false, $dec_point = '.', $thousands_sep = ',' ) {

    to:

    function bbp_number_format( $number = 0, $decimals = false, $dec_point = '.', $thousands_sep = '' ) {

    This removes the comma from the thousands separator. No all topics pages appear correctly. Thanks!

    • This reply was modified 1 year, 11 months ago by  matrixd.
    • This reply was modified 1 year, 11 months ago by  matrixd.

    Filed a bug report in trac – http://bbpress.trac.wordpress.org/ticket/1974

    Will hopefully get a patch soon have this fixed for 2.2 :)

    Thanks for reporting the bug!


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    That fixes one issue, and breaks everything else. :)


    matrixd
    Participant

    @matrixd

    So far everything appears to be OK for us, we only need to remember to apply the fix again after every BBpress upgrade until it is fixed officially.

    Also just to mention that this bug could occur only on European forums? I noticed something that made me think so: In Greece and most European countries we use the comma (,) as a decimal separator, actually what was happening, it was interpreting 2,033 as 2 replies.

    We found that in discussions with 27,300 and 30,156 replies it was displaying 2 pages, because it was interpreting 27,300 to 27 replies and 30,156 to 30

    • This reply was modified 1 year, 11 months ago by  matrixd.

    zaerl
    Participant

    @zaerl

    /wp-content/plugins/bbpress/bbp-includes/bbp-topic-template.php line 686:

    $total = bbp_get_topic_reply_count( $topic_id );
    

    this is erroneous because of this:

    /wp-content/plugins/bbpress/bbp-includes/bbp-core-filters.php line 158:

    add_filter('bbp_get_topic_reply_count', 'bbp_number_format', 10);
    

    Actually speaking bbp_get_user_topic_count, bbp_get_user_reply_count, bbp_get_user_post_count, bbp_get_forum_subforum_count, bbp_get_forum_topic_count, bbp_get_forum_reply_count, bbp_get_forum_post_count, bbp_get_topic_voice_count, bbp_get_topic_reply_count and bbp_get_topic_post_count are all affected by this bug.


    zaerl
    Participant

    @zaerl

    I suggest to insert an additional filter on all the functions described above. This is an example for bbp_get_topic_reply_count: https://gist.github.com/3884515

    All the functions that ‘echo’ values are used on templates and it’s the best place where to put a cosmetic filter like number_format.

Viewing 10 replies - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.