You are here

function _ajax_comments_get_comment_sort_order in AJAX Comments 7

Returns comment sort order.

comment_goodnes module and comment_sort_created compatibility: 1 - Older first 2 - Newer first

3 calls to _ajax_comments_get_comment_sort_order()
ajax_comments_reply in ./ajax_comments.module
Callback for clicking "reply". Note: $pid is an optional parameter. This functionality is utilized by the "Add new comment" link on pages where there is no default comment form (comment_form_location is COMMENT_FORM_SEPARATE_PAGE)
ajax_comments_submit_js in ./ajax_comments.module
Builds the comment.
_ajax_comments_nodejs_view_added in ajax_comments_nodejs/ajax_comments_nodejs.module
Implements _ajax_comments_nodejs_view_added().

File

./ajax_comments.module, line 823
AJAX comments module file.

Code

function _ajax_comments_get_comment_sort_order($node) {
  $result =& drupal_static(__FUNCTION__);
  if (!isset($result)) {
    $result = 1;
    if (module_exists('comment_goodness')) {
      $result = variable_get('comment_default_sorting_' . $node->type, comment_goodness_OLDER_FIRST);
    }
    else {
      if (module_exists('comment_sort_created')) {
        $result = variable_get('comment_sort_created_order_' . $node->type) == COMMENT_SORT_CREATED_OLDER_FIRST ? 1 : 2;
      }
      else {
        if (module_exists('sort_comments')) {
          $result = variable_get('comment_default_sorting_' . $node->type, SORT_COMMENTS_OLDER_FIRST);
        }
      }
    }
  }
  return $result;
}