Same name and namespace in other branches
  1. 4.6.x modules/forum.module \_forum_get_topic_order()
  2. 4.7.x modules/forum.module \_forum_get_topic_order()
  3. 5.x modules/forum/forum.module \_forum_get_topic_order()
  4. 6.x modules/forum/forum.module \_forum_get_topic_order()

Gets topic sorting information based on an integer code.

Parameters

$sortby: One of the following integers indicating the sort criteria:

  • 1: Date - newest first.
  • 2: Date - oldest first.
  • 3: Posts with the most comments first.
  • 4: Posts with the least comments first.

Return value

An array with the following values:

  • field: A field for an SQL query.
  • sort: 'asc' or 'desc'.
1 call to _forum_get_topic_order()
forum_get_topics in modules/forum/forum.module
Gets all the topics in a forum.

File

modules/forum/forum.module, line 1317
Provides discussion forums.

Code

function _forum_get_topic_order($sortby) {
  switch ($sortby) {
    case 1:
      return array(
        'field' => 'f.last_comment_timestamp',
        'sort' => 'desc',
      );
      break;
    case 2:
      return array(
        'field' => 'f.last_comment_timestamp',
        'sort' => 'asc',
      );
      break;
    case 3:
      return array(
        'field' => 'f.comment_count',
        'sort' => 'desc',
      );
      break;
    case 4:
      return array(
        'field' => 'f.comment_count',
        'sort' => 'asc',
      );
      break;
  }
}