You are here

function node_expire_outdated_nodes in Node expire 6

Same name and namespace in other branches
  1. 5 node_expire.module \node_expire_outdated_nodes()

List all currently expired nodes

1 string reference to 'node_expire_outdated_nodes'
node_expire_menu in ./node_expire.module
Implementation of hook_menu().

File

./node_expire.inc, line 11
Non hook functions.

Code

function node_expire_outdated_nodes() {

  // Prepare for the content
  $header = array(
    array(
      'data' => t('Title'),
      'field' => 'b.title',
    ),
    array(
      'data' => t('Last Updated'),
      'field' => 'b.changed',
      'width' => '150px',
    ),
    array(
      'data' => t('Expiration Date'),
      'field' => 'a.expire',
      'sort' => 'asc',
      'width' => '150px',
    ),
    array(
      'data' => t('Owner'),
      'field' => 'c.name',
    ),
    array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );

  // Figure out what documents are old
  $query = db_query("SELECT a.nid, a.expire, b.title, b.changed, c.name\n    FROM {node_expire} a\n    LEFT JOIN {node} b ON a.nid = b.nid\n    LEFT JOIN {users} c ON b.uid = c.uid\n    WHERE a.expire <= %d AND a.expiremode <> %d AND b.status = 1" . tablesort_sql($header), time(), NODE_EXPIRE_NONE);
  while ($node = db_fetch_object($query)) {
    $data[] = $node;
  }
  return theme('node_expire_outdated_nodes', $header, $data);
}