Skip to content

Instantly share code, notes, and snippets.

@ntwb
Created July 18, 2012 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntwb/3133450 to your computer and use it in GitHub Desktop.
Save ntwb/3133450 to your computer and use it in GitHub Desktop.
bbPress custom last_poster_block
<?php
// bbPress custom last_poster_block code by @Lynq
// Demo: http://teamoverpowered.com/forums/
// Code Discussion: http://bbpress.org/forums/topic/customising-bbp_list_forums-last-poster-block/
/** Last poster / freshness block for forums */
public function custom_last_poster_block( $subforum_id = "" ) {
echo BBP_Default::custom_get_last_poster_block( $subforum_id = "" );
}
public function custom_get_last_poster_block( $subforum_id = "" ) {
if ( !empty( $subforum_id ) ) {
// Main forum display with sub forums
$output = "<div class='last-posted-topic-title'>";
$output .= "<a href='". bbp_get_forum_last_topic_permalink( $subforum_id ) ."'>" . bbp_get_topic_last_reply_title( bbp_get_forum_last_active_id( $subforum_id ) ) . "</a>";
$output .= "</div>";
$output .= "<div class='last-posted-topic-user'>by ";
$author_id = bbp_get_forum_last_reply_author_id( $subforum_id );
$output .= "<span class=\"bbp-author-avatar\">" . get_avatar( $author_id, '14' ) . "&nbsp;</span>";
$output .= bbp_get_user_profile_link( $author_id );
$output .= "</div>";
$output .= "<div class='last-posted-topic-time'>";
$output .= bbp_get_forum_last_active_time( $subforum_id );
$output .= "</div>";
} else {
// forum category display (no sub forums list)
$output = "<div class='last-posted-topic-title'>";
$output .= "<a href='". bbp_get_forum_last_topic_permalink() ."'>" . bbp_get_topic_last_reply_title( bbp_get_forum_last_active_id() ) . "</a>";
$output .= "</div>";
$output .= "<div class='last-posted-topic-user'>by ";
$output .= "<span class=\"bbp-author-avatar\">" . get_avatar( bbp_get_forum_last_reply_author_id(), '14' ) . "&nbsp;</span>";
$output .= bbp_get_user_profile_link( bbp_get_forum_last_reply_author_id() );
$output .= "</div>";
$output .= "<div class='last-posted-topic-time'>";
$output .= bbp_get_forum_last_active_time();
$output .= "</div>";
}
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment