function anonymous_publishing_pet_realnames in Anonymous Publishing 7
Menu callback: Form to manage Anonymous Publishing PET real names.
Return value
array $form
1 string reference to 'anonymous_publishing_pet_realnames'
- anonymous_publishing_pet_menu in modules/
pet/ anonymous_publishing_pet.module - Implements hook_menu().
File
- modules/
pet/ anonymous_publishing_pet.module, line 63 - Main hooks for Anonymous Publishing PET module.
Code
function anonymous_publishing_pet_realnames($form, &$form_state) {
$form = array();
$form['#tree'] = TRUE;
$form['apu_info'] = array(
'#markup' => t('<p>The following table shows the real names and subject lines for nodes published as anonymous.</p>'),
);
// Fetch all real names.
$rows = db_query("SELECT a.rnid, a.nid, a.cid, a.uid FROM {anonymous_publishing_realname} a ORDER BY nid")
->fetchAll(PDO::FETCH_ASSOC);
$form['realnames'] = array();
foreach ($rows as $row) {
$form['realnames'][$row['rnid']] = array();
$form['realnames'][$row['rnid']]['rnid'] = array(
'#markup' => $row['rnid'],
);
$form['realnames'][$row['rnid']]['nid'] = array(
'#markup' => !$row['cid'] ? l($row['nid'], 'node/' . $row['nid']) : $row['nid'],
);
$form['realnames'][$row['rnid']]['cid'] = array(
'#markup' => $row['cid'] ? l($row['cid'], 'comment/' . $row['cid'], array(
'fragment' => 'comment-' . $row['cid'],
)) : $row['cid'],
);
$theuser = user_load($row['uid']);
$form['realnames'][$row['rnid']]['realname'] = array(
'#markup' => check_plain($theuser->name) . ' (#' . $row['uid'] . ')',
);
if ($row['cid']) {
$comm = comment_load($row['cid']);
$title = $comm ? check_plain($comm->subject) : '-deleted-';
}
else {
$node = node_load($row['nid']);
$title = $node ? check_plain($node->title) : '-deleted-';
}
$form['realnames'][$row['rnid']]['subhect'] = array(
'#markup' => check_plain($title),
);
}
return $form;
}