Skip to:
Content
Pages
Categories
Search
Top
Bottom

Freshness Linked

Viewing 21 replies - 1 through 21 (of 21 total)
  • Not sure how to do that specifically, however here’s a quick rip of Sam Bauer’s pagination plugin that’ll add a double-forward arrow to the end of each topic name linking to the latest post. Copy it into a text file, save it as something.php and upload.

    <?php
    /*
    Plugin Name: Link to last Post
    Plugin URI:
    Description: Adds page links to topic lists
    Author: fel64
    Version: 0.7
    Author URI: http://www.loinhead.net/
    */

    if (!function_exists('is_tags')) {
    function is_tags()
    {
    return is_tag();
    }
    }

    if (is_front() || is_forum() || is_tags()) {
    add_filter('topic_title', 'fel_addlatestlink', 101);
    }

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

    return $title;
    }
    ?>


    citizenkeith
    Participant

    @citizenkeith

    <Montgomery Burns>Excellent</Montgomery Burns>

    Thanks! That’ll do the trick.

    The only thing better than that is a “go to first new reply” link. :)

    I noticed a typo in your code. I think you meant `<C. Montgomery Burns>Excellent</C. Montgomery Burns>.

    Just kidding.


    citizenkeith
    Participant

    @citizenkeith

    I’ve been out-geeked! :(

    The only thing better than that is a “go to first new reply” link. :)

    Out of the corner of my eye I thought I saw some code for “views” in a thread, in the 1.0-alpha version. There’s a chance it’ll be in 1.5 maybe? :)

    There’s also my “has a new reply” plugin: https://bbpress.org/plugins/topic/45?replies=5


    citizenkeith
    Participant

    @citizenkeith

    A few weeks ago, I recounted everything, and suddenly this plugin (in fel64’s post) doesn’t work anymore. You click on the >> to get to the latest post, and it takes you to a page without any posts, and it states that the thread is closed, even though it isn’t closed.

    For example:

    http://www.citizenkeith.com/forums/topic.php?id=29&page=143&replies=713#post-8940

    It should have been something like this:

    http://www.citizenkeith.com/forums/topic.php?id=29&page=24&replies=716#post-8943

    Replies/Posts are off by 3, and pages are off by 119!!

    The topic closed thing comes from the pagecount being too high. I think get_topic_last_post_link() must be screwing up – did the latest reply thing stop working immediately after recount? Not sure what the solution is, sorry. Perhaps get the latest version, see if the problem persists?

    I just recounted on my forum (running 1.0-alpha), but it seems to still work.


    citizenkeith
    Participant

    @citizenkeith

    did the latest reply thing stop working immediately after recount?

    Yes, it was fine until I ran that. It immediately stopped working. Which is strange, because iI had recounted before.

    Perhaps get the latest version, see if the problem persists?

    I’ll wait until there’s an official release of 1.0. It’s not a huge problem, so I’ll wait. Thanks though!


    citizenkeith
    Participant

    @citizenkeith

    Just noticed… the “latest post” links don’t work via the front page, but they work when you are viewing the threads in a single forum. For example, they don’t work here:

    http://www.citizenkeith.com/forums/index.php

    But the DO work here:

    http://www.citizenkeith.com/forums/forum.php?id=1&page

    The forum you linked to is private (and incidentally that apostrophe in the error message is escaped once too many times). For the single non-private thread on your forum front page, though, the link works for me (as it does when you view forums individually). I can’t reproduce the error now? I could earlier, though – strange. Thanks for mentioning it.


    citizenkeith
    Participant

    @citizenkeith

    Thanks for checking that… so is there a problem with the pagination of Forum ID #1? If you want to poke around, I can create a test login for you. login/pass is test/test

    Forum 1 is private, and I can’t login using “test” and “test” :( Last time I checked, though, the latest post thing was screwed. :/


    citizenkeith
    Participant

    @citizenkeith

    Oops. Sorry about that! It works now.

    Latest post link is screwed for the forum named OBT. Threads from other forums work fine. WEIRD.


    citizenkeith
    Participant

    @citizenkeith

    fel64,

    Did you ever get a chance to this out? :)

    Sorry, forgot about this 😮 Looked at it, can’t figure out where it might go wrong, so here’s some slightly alternative code that will use a different function to do it’s thing and we’ll see if that works. Replace function fel_addlatestlink() with

    function fel_addlatestlink($title)
    {
    global $topic;
    //$felgtlpl = get_topic_last_post_link($topic->topic_id);
    $felgtlpl = get_post_link( $topic->topic_last_post_id );
    $title = $title . ' <a href="' . $felgtlpl . '">&nbsp;&raquo;&nbsp;</a>';

    return $title;
    }


    citizenkeith
    Participant

    @citizenkeith

    Thanks fel… still no go. The only difference is that the thread isn’t shown as “closed.”

    Sorry Keith, not a clue. Have you tried disabling all plugins and recounting?


    citizenkeith
    Participant

    @citizenkeith

    Ok, I finally got around to some testing. I have disabled almost all plugins and recounted… still the same behavior. However, I was unable to disable “Online List” and “BBPress Private Messaging” because it broke the admin console. So there’s a chance that one of those plugins might be causing this strange behavior.

    Interesting, at least that eliminates some things.

    Why do they break bb-admin? That’s really awful behaviour anyway, but it would be good if you could try to deactivate them at least. Deleting them will of course work but if that breaks bb-admin then that’s a bad idea I guess.


    citizenkeith
    Participant

    @citizenkeith

    I think bb-admin is broken because I had to edit some template files… I honestly haven’t taken the time to find out yet. It’s on the list for tonight though. :)


    _ck_
    Participant

    @_ck_

    “get_topic_last_post_link()” and it’s dependency “get_post_link()” relies on two important things which can be easily thrown off in bbpress or it’s db

    1. if you are using a plugin or other code to change the number of topics shown on the front page or forum pages vs the topic page, get_topic_last_post_link() will calculate the last post incorrectly. This is because there is only one universal setting in bbpress right now for the number of items per page (there should be an array in the core so limit can be different than limit and then get_topic_last_post_link() will know to look at the destination limit instead of where it’s coming from)

    see my bug fix for custom limits for each page here:

    https://bbpress.org/forums/topic/custom-topics-count-for-different-pages-that-doesnt-break-last-post

    it basically forces get_post_link to recalculate

    2. get_topic_last_post_link() relies on the post_position in the bbpress table – which can get messed up if there are deleted posts, moved/merged posts, or recounts

    Recounts does not attempt to recalculate and resave the post_position. This would have to be written. It basically would have to look at all posts in a topic, sort them by the desired date order, and then renumber them.

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