Skip to:
Content
Pages
Categories
Search
Top
Bottom

BUG: Previous link on frontpage pagination doesn't work

  • I’m running bbPress 1.0.2.

    I’m having problems with the “PREVIOUS” link when using the “bb_latest_topics_pages” function.

    I have the following code on my frontpage.php


    <?php endforeach; endif; // $topics ?>

    <?php bb_latest_topics_pages( array( ‘before’ => ‘<div class=”nav”>’, ‘after’ => ‘</

    div>’ ) ); ?>


    It display paged frontpage topic links (1, 2, 3, Next) but whenever I’m on a page other than the frontpage … for example, Page 2, both the Previous and Page 1 link points to the current page and not the previous page.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Are you using the kakumei template? Here is what I have in my front-page.php file:

    <?php endforeach; endif; // $topics ?>

    </table>

    <?php bb_latest_topics_pages( array( ‘before’ => ‘<div class=”nav”>’, ‘after’ => ‘</div>’ ) ); ?>

    <?php endif; // $topics or $super_stickies ?>

    and have not had any issues.

    Can you paste the html code generated for your links to provide more information?

    @hatter

    The code you have above is exactly what I have.

    You can view the code live at: http://bit.ly/8yfVim

    Notice this is Page 2, when the “Previous” link does not work correct. The “Previous” link links to the same page (page 2) and not the frontpage.

    It appears to be an issue with permalinks. Try and add this line to your bb-config.php file:

    $bb->mod_rewrite = false;

    If this is the case, make sure you setup permalinks correctly, since they don’t work out of the box. You can see how to do it Here

    @hatter

    I went into the Admin panel and re-selected to use the “example.com/forums/first-forum” type of permalinks.

    This then regenerated the appropriate code for my .htaccess file; HOWEVER, I’m still experiencing the exact same issues.

    Also, when I added the “$bb->mod_rewrite = false;” code to my bb-config.php file, my entire site broke. So I remove the “$bb->mod_rewrite = false;” code.

    Not sure why your site would break with that code. Did you add it to the end of the file, before the ?> ? Also, have you tried turning off permalinks to see if that works for your site?

    @hatter

    If I go into the Admin panel and turn off Permalinks, it does in fact work (though the “Previous” link, links to http://www.example.com/? – note the trailing “?” … but it does technically work).

    Any idea how I can get this to work using the “named based” permalink? Having this only work with the kludgy no-permalink structure is not ideal.

    This may sound kinda stupid, but after looking at the code, can you add topics to your forum to create a page 3 to see if you still have the issue? I’m just wondering if this issue only occurs when you only have 2 pages worth of topics. Can you test this real quick to see if this is the case? I will keep looking into it in the mean time.

    @hatter

    I’ve updated my site, link in above post, to now have 4 pages. You’ll see that the “Page 1″ link is always messed up when you’re viewing it not from the frontpage.

    Ok, I think I see the problem now. If you look at the source code for the page 1 link, it generates an empty href element, which by default will link back to the current page. This is generated in the bb_paginate_links function in bb-includesfunctions.bb-core.php. Can you try something real quick, as a possible fix? Around line 244, you will see the following:

    $empty_format = ”;

    Change this to:

    $empty_format = ‘/’;

    This will generate an href of “/” which should lead to the root of your forum. Please let us know if this works.

    @hatter

    Changing $empty_format = ””;

    to

    $empty_format = ”/”;

    make’s it work.

    MANY, MANY thanks. Anyway of me being able to make this work now without having to modify the core bbPress code? My concern is that I want to be able to upgrade bbPress in the future without having to remember I made this modification to the core function.

    Also, how to I file a code patchset to fix this bug for others?

    I’m glad it’s working for you. Though this is not an ideal fix, it at least works for now. You were correct in your title in that this is a bug with permalinks. And you are correct that this could be an issue in the future when upgrading. I created a ticket, so hopefully this will be fixed in the future for yourself and other users.

    FYI, in the future, if you find / solve a bug, tickets can be created at http://trac.bbpress.org


    johnhiler
    Member

    @johnhiler

    You can work around the bug by installing the topics-per-page plugin, and then editing your template:

    http://bbpress.org/forums/topic/navigation-not-working-only-for-page-1#post-56239

    You can find the plugin here:

    http://bbpress.org/plugins/topic/front-page-topics/

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

You must be logged in to reply to this topic.