summaryrefslogtreecommitdiff
path: root/modules/comment/comment.admin.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-02-22 16:53:41 +0000
committerDries Buytaert <dries@buytaert.net>2009-02-22 16:53:41 +0000
commitb3e36d655c831c63c26a710eb3c8bd82ca3b6fc5 (patch)
treeaf24f8462bd347de36cd7375fc78dffb48e7d0b9 /modules/comment/comment.admin.inc
parente1652e99b61577ac42d6d6618420c872c0e42435 (diff)
downloadbrdo-b3e36d655c831c63c26a710eb3c8bd82ca3b6fc5.tar.gz
brdo-b3e36d655c831c63c26a710eb3c8bd82ca3b6fc5.tar.bz2
- Patch #299267 by Crell: add extender support to the SELECT query builder.
Diffstat (limited to 'modules/comment/comment.admin.inc')
-rw-r--r--modules/comment/comment.admin.inc17
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/comment/comment.admin.inc b/modules/comment/comment.admin.inc
index 9a35014b9..8d88ec77e 100644
--- a/modules/comment/comment.admin.inc
+++ b/modules/comment/comment.admin.inc
@@ -66,13 +66,26 @@ function comment_admin_overview($type = 'new', $arg) {
'operations' => array('data' => t('Operations')),
);
- $result = pager_query('SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid, n.title as node_title FROM {comment} c INNER JOIN {user} u ON u.uid = c.uid INNER JOIN {node} n ON n.nid = c.nid WHERE c.status = %d' . tablesort_sql($header), 50, 0, NULL, $status);
+ $query = db_select('comment', 'c');
+ $query->join('user', 'u', 'u.uid = c.uid');
+ $query->join('node', 'n', 'n.nid = c.nid');
+ $query->addField('u', 'name', 'registered_name');
+ $query->addField('n', 'title', 'node_title');
+ $query
+ ->fields('c', array('subject', 'nid', 'cid', 'comment', 'timestamp', 'status', 'name', 'homepage'))
+ ->fields('u', array('uid'))
+ ->condition('c.status', $status)
+ ->extend('PagerDefault')->extend('TableSort')
+ ->limit(50)
+ ->setHeader($header);
+ $result = $query->execute();
+
// Build a table listing the appropriate comments.
$options = array();
$destination = drupal_get_destination();
- while ($comment = db_fetch_object($result)) {
+ foreach ($result as $comment) {
$options[$comment->cid] = array(
'subject' => l($comment->subject, 'node/' . $comment->nid, array('attributes' => array('title' => truncate_utf8($comment->comment, 128)), 'fragment' => 'comment-' . $comment->cid)),
'author' => theme('username', $comment),