summaryrefslogtreecommitdiff
path: root/modules/comment/comment.admin.inc
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-07 05:23:52 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-07 05:23:52 +0000
commitf562e86581faa0cc3da859cebb185b2c52b179da (patch)
treea5c248f5d96246edf89d2077a0ed0d704526a853 /modules/comment/comment.admin.inc
parent3ede61995539d7f4b1ee0b7f30897b849400f490 (diff)
downloadbrdo-f562e86581faa0cc3da859cebb185b2c52b179da.tar.gz
brdo-f562e86581faa0cc3da859cebb185b2c52b179da.tar.bz2
#538164 by scor, catch, linclark, effulgentsia, and yched: Convert Comment body as field. Yes, this is WAY past API freeze. :( But is a required follow-up for RDFa support.
Diffstat (limited to 'modules/comment/comment.admin.inc')
-rw-r--r--modules/comment/comment.admin.inc19
1 files changed, 13 insertions, 6 deletions
diff --git a/modules/comment/comment.admin.inc b/modules/comment/comment.admin.inc
index 9c773dec5..5fed67a35 100644
--- a/modules/comment/comment.admin.inc
+++ b/modules/comment/comment.admin.inc
@@ -67,31 +67,38 @@ function comment_admin_overview($form, &$form_state, $arg) {
);
$query = db_select('comment', 'c')->extend('PagerDefault')->extend('TableSort');
- $query->join('users', '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');
$result = $query
- ->fields('c', array('subject', 'nid', 'cid', 'comment', 'changed', 'status', 'name', 'homepage'))
- ->fields('u', array('uid'))
+ ->fields('c', array('cid', 'subject', 'name', 'changed'))
->condition('c.status', $status)
->limit(50)
->orderByHeader($header)
->execute();
+ // We collect a sorted list of node_titles during the query to attach to the
+ // comments later.
+ foreach ($result as $row) {
+ $cids[] = $row->cid;
+ $node_titles[] = $row->node_title;
+ }
+ $comments = comment_load_multiple($cids);
// Build a table listing the appropriate comments.
$options = array();
$destination = drupal_get_destination();
- foreach ($result as $comment) {
+ foreach ($comments as $comment) {
+ // Dequeue the first node title from the node_titles array and attach to
+ // the comment.
+ $comment->node_title = array_shift($node_titles);
$options[$comment->cid] = array(
'subject' => array(
'data' => array(
'#type' => 'link',
'#title' => $comment->subject,
'#href' => 'comment/' . $comment->cid,
- '#options' => array('attributes' => array('title' => truncate_utf8($comment->comment, 128)), 'fragment' => 'comment-' . $comment->cid),
+ '#options' => array('attributes' => array('title' => truncate_utf8($comment->comment_body[LANGUAGE_NONE][0]['value'], 128)), 'fragment' => 'comment-' . $comment->cid),
),
),
'author' => theme('username', array('account' => $comment)),