You are here

function advanced_forum_last_post_link in Advanced Forum 6.2

Same name and namespace in other branches
  1. 5 advanced_forum.module \advanced_forum_last_post_link()
  2. 6 advanced_forum.module \advanced_forum_last_post_link()
  3. 7.2 advanced_forum.module \advanced_forum_last_post_link()

Get a link to the last post in a topic.

Parameters

$node: Node object

Return value

Text linking to the last post in a topic.

1 call to advanced_forum_last_post_link()
advanced_forum_preprocess_advanced_forum_topic_header in includes/theme.inc
Preprocesses template variables for the topic header template.

File

./advanced_forum.module, line 866
Enables the look and feel of other popular forum software.

Code

function advanced_forum_last_post_link($node) {
  $last_comment_id = advanced_forum_last_post_in_topic($node->nid);

  // Return empty link if post doesn't have comments.
  if (empty($last_comment_id)) {
    return;
  }
  $last_page = advanced_forum_get_last_page($node);
  $query = $last_page > 0 ? "page={$last_page}" : '';
  $options = array(
    'html' => TRUE,
    'query' => $query,
    'fragment' => "comment-{$last_comment_id}",
  );
  return theme('advanced_forum_l', t('Last post'), "node/{$node->nid}", $options, 'large');
}