function heartbeat_comments_admin_overview_submit in Heartbeat 6.4
Same name and namespace in other branches
- 7 modules/heartbeat_comments/heartbeat_comments.admin.inc \heartbeat_comments_admin_overview_submit()
Process heartbeat_comments_admin_overview form submissions.
Execute the chosen 'Update option' on the selected comments, such as publishing, unpublishing or deleting.
File
- modules/
heartbeat_comments/ heartbeat_comments.admin.inc, line 87 - Admin page callbacks for the heartbeat comments module.
Code
function heartbeat_comments_admin_overview_submit($form, &$form_state) {
if ($form_state['values']['operation'] == 'delete') {
// extract the appropriate database query operation
$query = "DELETE FROM {heartbeat_comments} WHERE hc.hcid = % ";
foreach ($form_state['values']['comments'] as $cid => $value) {
if ($value) {
// perform the update action, then refresh node statistics
db_query($query, $cid);
// Add an entry to the watchdog log.
watchdog('content', 'Heartbeat comment: updated %subject.', array(
'%subject' => strip_tags($comment->message),
), WATCHDOG_NOTICE);
}
}
drupal_set_message(t('The update has been performed.'));
$form_state['redirect'] = 'admin/content/heartbeat/comments';
}
}