You are here

function _classified_get_ads_query in Classified Ads 6.3

2 calls to _classified_get_ads_query()
_classified_page_user_ads in ./classified.module
Page callback for user/<uid>/classified
_classified_token_values in ./classified.tokens.inc
Implements hook_token_values().

File

./classified.module, line 194
A pure D6 classified ads module inspired by the ed_classified module.

Code

function _classified_get_ads_query($min_status = 1) {
  $sq = <<<EOT
    SELECT n.nid, n.title, n.status,
      nr.body, nr.format,
      cn.expires
    FROM {node} n
      INNER JOIN {node_revisions} nr ON n.nid = nr.nid AND n.vid = nr.vid
      LEFT JOIN {classified_node} cn ON n.nid = cn.nid AND n.vid = cn.vid
    WHERE
      n.type = 'classified' AND n.uid = %d AND n.status >= %d
    ORDER BY
      cn.expires ASC, n.changed ASC, n.created ASC
EOT;
  $sq = db_rewrite_sql($sq);

  // work around limitations in pager_query regexp
  $sq = trim(str_replace("\n", ' ', $sq));
  return $sq;
}