_forum_get_topic_order

function _forum_get_topic_order

_forum_get_topic_order($sortby)

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'.

File

modules/forum/forum.module, line 1316
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;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!forum!forum.module/function/_forum_get_topic_order/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部