Skip to:
Content
Pages
Categories
Search
Top
Bottom

getting last post inside bb_forum_class()

  • @romerocw

    Member

    I’m trying to make my front-page.php template look a little more like a conventional vBulletin type theme by displaying the “last post title and link” in a column next to the “forum title.” The problem is that topic_title() isn’t giving me what I want inside the loop. I guess I need some sort of nested loop or an alternate function.

    Here’s an example of a vB style i’d like to emulate:

    Main Car Forum (This is a top level forum)

    Car Forums by Brand <– this is a bbPress category forum w/ subforums per car brand.

    — Honda Forum 1…………………….. last post: my car broke down

    — BMW Forum 2…………………….. last post: new tires?

    The problem is when I play w/ the front-page template I can only get the last post info for the “Main Car Forum” not the brand subforums and even that isn’t actually giving me what I think it should.

    Here’s what I have in my 2nd HTML column of my modified template:

    <td class="topicTitle"><a href="<?php topic_last_post_link(); ?>"><?php topic_title(); ?> </a>
    <br /><span class="lastPoster">by <a href="<?php user_profile_link($topic->topic_last_poster) ?>"><?php topic_last_poster(); ?></a></span>
    </td>

    The topic_last_post_link and topic_title() aren’t giving me the expected results. For topic_last_post_link it’s actually returning the last topic/thread link not the last post link and that’s for the “Main Car Forum.” For the subforums it’s displaying the same exact thing as it does for “Main Car Forum” it’s not actually displaying the topic/post info for the correct subforum.

    TIA,

    -Charlie

Viewing 3 replies - 1 through 3 (of 3 total)
  • @_ck_

    Participant

    Did you try my forum-last-poster plugin?

    @romerocw

    Member

    Thanks _ck_, I just downloaded it and installed it. I have a question and a comment.

    1st Q: Am I missing something simple? Is there a way to get forum_last_post_title() in addition to the link? I”d like the link title to be the post title. With your plugin I can create an href of the last post and link to it but the link text has to be the URL. I’d like the link text to be the post title.

    2nd comment: There is something weird going on inside the bb_fourm_class() loop. If I do this code the plugin works correctly giving me the last post link:

    <td class="topicTitle"> <?php forum_time(); ?> <a href="<?php forum_last_post_link(); ?>"><?php forum_last_post_link(); ?> </a> <?php forum_time(); ?>
    <br /><span class="lastPoster">by <a href=""><?php forum_last_poster(); ?></a></span>
    <span class="topicTime">at <?php topic_time('M. j, Y'); ?></span>
    </td>

    If I remove the first occurrence of <?php forum_time(); ?> and let the loop see “> first then the plugin doesn’t work correctly and the incorrect first post link is displayed. The following breaks the plugin for the 1st occurence of a link. The subforum link does work correctly.

    <td class="topicTitle"> <a href="<?php forum_last_post_link(); ?>"><?php forum_last_post_link(); ?> </a> <?php forum_time(); ?>
    <br /><span class="lastPoster">by <a href=""><?php forum_last_poster(); ?></a></span>
    <span class="topicTime">at <?php topic_time('M. j, Y'); ?></span>
    </td>

    See if you can reproduce it in one of your templates. I can reproduce it here.

    @romerocw

    Member

    _ck_ I went to the comments page for your plugin and saw where you wrote how to get the title of the topic.

    topic_title(forum_last_topic_id());

    Thank you.

    Still can’t quite figure out the other weird problem though.

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