Skip to:
Content
Pages
Categories
Search
Top
Bottom

Plugin: Page links for bbPress


  • Sam Bauers
    Participant

    @sambauers

    Here’s one a few people have asked for. This plugin adds links to pages within each topic in all topic lists.

    Download latest version here

Viewing 19 replies - 1 through 19 (of 19 total)
  • The is also a trac ticket for this


    Sam Bauers
    Participant

    @sambauers

    So that’s the other place I saw it. I’ve updated that ticket.

    It’s not working for me…

    On topics with a single page, I get this error:

    Bad arguments. in blah blah blah/bbpress/
    my-plugins/page-links.php on line 68

    When I click on a page link, I get this error:

    Fatal error: Call to undefined function: is_tags() in
    /blah blah blah/bbpress/
    my-plugins/page-links.php on line 33

    Any idea what’s wrong?

    Also, I would recommend that you add an option for the links to be text-only instead of the CSS/image based ones. Thanks for putting this plugin out for all of us.


    Sam Bauers
    Participant

    @sambauers

    What version of bbPress are you using. I have to admit that I haven’t tested against 0.8.1, only against the latest 1.0 alpha

    I think I know what went wrong though. Download and try again, I’ve updated the version to 1.0.1

    The links are text-only. If you don’t want the images/styles just remove them from the CSS file.

    Cheers Sam, worked beautifully. I put your CSS in my style.css and played around with it until eventually getting rid of all extra styling :P But it works great. That was a major annoyance. Thanks. :D

    Sam, I am on .8.1, but it is working fine now.

    This plugin doesn’t play nicely with the Front Page Topics plugin. I had it set to show 25 posts per page on topics pages, so I would only have 2 or 3 pages, whereas your plugin would count 5 or 6. When I would click on a link to a page that was beyond the actual pagination, I would get a “This topic is closed” message. I went ahead and just deleted the Front Page Topics plugin and it is working fine now.

    Would there be a way to change the number of posts per page in your plugin from the default 10, or better yet to look for the front page topics and count based on the options in that plugin? Just curious.

    Thanks.

    Hmm take out the images and put the page numbers between (..), makes your plugin easier to install (no difficult stuff with images, extra uploading etc)… just my 2 cents


    Sam Bauers
    Participant

    @sambauers

    @fel64 – You don’t have to copy the styles into another style sheet, just edit the styles in the file page-links.css

    @wittmania – I’ve updated the plugin to be compatible with “Front Page Topics”, it’s more a design problem with that plugin, but I’ve worked around it.

    @Null – All that has to be done is copying the three files, one php, one css, one image into the my-plugins folder. If you want to change the styles then just edit them in the CSS file. I couldn’t have made it any easier given I wanted it to be easily styled for different layouts without having to modify templates.

    I mis the page 1

    I know clicking the title you go to page 1, but we are all known with the vbulletin way…

    So if it has one page, dont show the page tags

    If it has two, show the page 1 and page 2 tags

    etc etc


    Sam Bauers
    Participant

    @sambauers

    Comment out this line in the plugin to get page 1 showing.

    unset($links[0]);

    That’s line 82 in version 1.0.2

    I also added a snippet of code to append a link to the last post.

    Find the end of the function page_links_add_links and replace this

    return $title;
    }

    with this

    $felgtlpl = get_topic_last_post_link($topic->topic_id);
    $title = $title . ' <a href="' . $felgtlpl . '">&nbsp;&raquo;&nbsp;</a>';

    return $title;
    }


    Sam Bauers
    Participant

    @sambauers

    Now available in bbPress plugin browser:

    https://bbpress.org/plugins/topic/43

    Thanks for this Sam, looking at it I also made a plugin using the Simple Onlinelist which will highlight any new posts made since the last time someone logged in. :) Waiting to have it approved as a plugin so I can upload.

    _ck_’s “bbpress topic limit” plugin seems to screw with the count for this plugin – I get 9 pages for topics which only have 3, and other weird calculation errors – anyone know of a fix?


    Ivaylo Draganov
    Member

    @dragunoff

    Hey, anybody still using that plugin? I mean – anybody with a bbPress 0.9 install…

    Because I’d like to know if someone can help me with a little improvement. The plugin works great except for that it shows all the pages for a topic. And certain topics have more that 20-30 pages!

    So I wonder if it is not too hard to make that plugin display links only to the first page and the last 4-5 pages? Just like the default in-topic pagination.

    I wonder if it is possible to port that functionality directly form bbPress 1.0?

    Thanks


    Ivaylo Draganov
    Member

    @dragunoff

    well, I found out part of the solution myself. The code in the plugin is quite simple and it actually uses the same bbPress function that generates in-topic pagination (paginate_links).

    And that function has several parameters on of which is show_all – set that to false and it will not print all the links but just the links relative to the current page.

    Setting the current page for the plugin is also through a parameter – current which is set to 0. That way we get a link only to the last page but it still is better that having a long row of useless page links.

    =Edit=

    So, I cracked some more of it. I wanted to make it display links only to the firs page and to the last 2-3 pages. So the current parameter had to be somehow dynamically set to last page + 1 to trick the function. Here is the code I used (starting line 74 of the plugin):

    $links = paginate_links(
    array(
    'base' => $uri,
    'format' => bb_get_option('mod_rewrite') ? '/page/%#%' : '%#%',
    'total' => ceil($posts/$perPage),
    'current' => ceil($posts/$perPage) + 1,
    'show_all' => false,
    'type' => 'array'
    )
    );

    And it works =) We get links to the first page and to the last two pages.

    * if you set current to 1 you’ll get links to pages 2,3,4 and the last page which is also usable.


    _ck_
    Participant

    @_ck_

    Here is a version I super modified for maximum performance and compatibility.

    http://pastebin.com/embed_iframe.php?i=N4bxcqpZ

    It avoids the extra queries the original version does (when it looks for page-topics plugin/option) and caches a few expensive variables.

    It uses pure css with an inline stylesheet so there are no externals to load or check timestamps.

    (basically in plain english it puts as little impact as possible on the page)

    If someone REALLY wanted the page image it could be easily modified to support that again.

    This version only shows the ending page, or if over 5 pages the last two pages, which I think is plenty. (clicking the topic title is always page one anyway)

    _ck_ I’d love to use that fix but it seems to interfere with “freshly baked cookies” plugin. It spawns several PHP warnings when trying to logout. Something along the lines of:

    Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/forum/my-plugins/page-links-for-bbpress/page-links.php:74) in /home/public_html/forum/bb-includes/pluggable.php on line 242


    Kr3m1in
    Participant

    @kr3m1in

    Dead link.

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