function anonymous_publishing_cl_admin_moderation in Anonymous Publishing 7
Menu callback: Form to work with the moderation queue.
Return value
array Form.
1 string reference to 'anonymous_publishing_cl_admin_moderation'
- anonymous_publishing_cl_menu in modules/
cl/ anonymous_publishing_cl.admin.inc - Implements hook_menu().
File
- modules/
cl/ anonymous_publishing_cl.admin.inc, line 316 - Menu callbacks for the CL tabs on the module admin page.
Code
function anonymous_publishing_cl_admin_moderation($form, &$form_state) {
// Fetch all nodes that has been verified.
$sql = "SELECT a.apid, a.nid, a.cid, a.verified, a.alias, a.email, n.title, n.status FROM {anonymous_publishing} a JOIN {node} n ON a.nid = n.nid WHERE a.verified > 0 ORDER BY a.nid DESC";
$result = db_query($sql);
$form = array();
$form['#tree'] = TRUE;
$form['apm_info'] = array(
'#markup' => t('<p>The following table shows all nodes that have been verified by e-mail. You may publish or unpublish by adding or removing a mark in the “Published” column. Then press “Execute” to execute the changes.</p>'),
);
$form['ap_row'] = array();
while ($row = $result
->fetchAssoc()) {
if ($row['cid']) {
$comment = db_query("SELECT subject, status FROM {comment} WHERE cid = :cid", array(
':cid' => $row['cid'],
))
->fetchAssoc();
if ($comment) {
$title = $comment ? $comment['subject'] : t('-deleted-');
$status = $comment['status'];
}
else {
$title = t('-deleted-');
$status = 0;
}
}
else {
$title = $row['title'];
$status = $row['status'];
}
$alias = NULL === $row['alias'] ? '-reuse persistent-' : $row['alias'];
$form['ap_row'][$row['apid']] = array();
$form['ap_row'][$row['apid']]['status'] = array(
'#type' => 'checkbox',
'#default_value' => $status,
);
$form['ap_row'][$row['apid']]['nidmu'] = array(
'#markup' => $row['nid'],
);
$form['ap_row'][$row['apid']]['cidmu'] = array(
'#markup' => $row['cid'],
);
$form['ap_row'][$row['apid']]['title'] = array(
'#markup' => check_plain($title),
);
$form['ap_row'][$row['apid']]['alias'] = array(
'#markup' => check_plain($alias),
);
$form['ap_row'][$row['apid']]['email'] = array(
'#markup' => $row['email'] ? check_plain($row['email']) : t('(redacted)'),
);
$form['ap_row'][$row['apid']]['nid'] = array(
'#type' => 'hidden',
'#value' => $row['nid'],
);
$form['ap_row'][$row['apid']]['cid'] = array(
'#type' => 'hidden',
'#value' => $row['cid'],
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Execute'),
);
return $form;
}