You are here

function advanced_forum_get_last_page in Advanced Forum 7.2

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

Returns the page number of the last page starting at 0 like the pager does.

1 call to advanced_forum_get_last_page()
advanced_forum_last_post_link in ./advanced_forum.module
Get a link to the last post in a topic.

File

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

Code

function advanced_forum_get_last_page($node) {
  $comments_per_page = variable_get('comment_default_per_page_' . $node->type, 50);
  $comment_count = isset($node->comment_count) ? $node->comment_count : 0;
  $last_page = ceil($comment_count / $comments_per_page) - 1;
  return $last_page;
}