bbPress

Simple, Fast, Elegant

bbPress plugin browser »

Forum Last Poster (0.0.3)

Download

Version: 0.0.3

Last Updated: 2008-8-16

Requires bbPress Version: 0.8.2 or higher

Compatible up to: trunk

Author Homepage »

Plugin Homepage »

Donate to this plugin »

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(1)

Your Rating

Author: _ck_

Adds forum_last_poster(), forum_time(), forum_last_post_link() and other functions to bbPress to mimic the topic tables' FRESHNESS column. Requires simple template edits.

High performance: uses only a single extra query regardless of the number of forums listed (when topics are on same page).


  1. You can see a demonstration of this plugin in action by looking at the forum list at the top of http://bbshowcase.org/forums/

    (notice the "Last Poster" column)

    The code used to make that column is:

    <td class="num"><?php echo '<a href="'.get_forum_last_post_link().'">'.get_forum_last_poster().'<small>'.get_forum_time().' ago</a></small>'; ?></td>
    Posted: 4 months ago #
  2. Is this stuff can be used to display gravatar of last poster? If so, how?

    Posted: 4 months ago #
  3. csseur3

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Member

    if we can have the title of the last post, in wich last comment was made?

    and it is possible to add a function to truncate this, for the title wich are too big? :)

    great plugin ck! hum, i think is great if this plugin is in bbpress bu default :D

    bye,
    Fred

    Posted: 4 months ago #
  4. csseur3 you can take advantage of the function forum_last_topic_id() to fetch any info you'd like about the last topic in a forum.

    Here is an example of how to use it:
    topic_title(forum_last_topic_id());
    That will echo the last topic title to the screen.

    Or to store it and manipulate it further:

    $last_topic_title=get_topic_title(forum_last_topic_id());

    (you'll need to do some PHP to limit the length, like the substr function, see php.net)
    $last_topic_title=substr($last_topic_title,0,40);

    or you can fetch everything about the last topic:
    $last_topic=get_topic(forum_last_topic_id());
    and then you can determine things like how many posts it has:

    echo "Most recent topic has $last_topic->topic_posts posts";
    Posted: 4 months ago #
  5. Thion, you can fetch the gravatar through a little indirect code as I don't have a function in there yet to grab all the user's info.
    ie.

    $last_topic=get_topic(forum_last_topic_id());
    $last_topic_poster_id=$last_topic->topic_last_poster;
    $last_topic_poster_email=bb_get_user_email($last_topic_poster_id);

    then you use the email to get the gravatar:

    <img src="<?php echo "http://www.gravatar.com/avatar.php?gravatar_id=".md5($last_topic_poster_email); ?>">
    Posted: 4 months ago #
  6. Anonymous

    Unregistered

    And another thing.
    I have this line in my front-page.php
    <td class="num"><a href="<?php forum_last_post_link(); ?>"><?php forum_last_poster(); ?></a><br /><?php forum_time(); ?></td>
    And I have also this forum is category plugin.
    And the problem is that, I dont want this last poster to show if forum is catogory.
    Can you help me with this? I have been trying few things but I've failed.

    And this is the forum is category plugin: http://bbpress.org/plugins/topic/forum-is-category/

    Posted: 4 months ago #
  7. markok, you could try something like this:

    <td class="num"><?php if (!in_array($GLOBALS['forum']->forum_id, $GLOBALS['forums_that_are_categories'])) {
     ?><a href="<?php forum_last_post_link(); ?>"><?php forum_last_poster(); ?></a><?php } ?><br /><?php forum_time(); ?></td>
    Posted: 3 months ago #
  8. Anonymous

    Unregistered

    Thanks, that did the trick.

    Posted: 3 months ago #
  9. csseur3

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Member

    hey ck,

    when a forum was empty, we see the first post's title (the 'your-first-topic' by default) in the column. So i think it is interestig to create a "error message" like "sorry, this forum is empty" :p

    bye

    Posted: 3 months ago #

RSS feed for this topic

Add a Comment

You must log in to post.

Code is Poetry.