You are here

function heartbeat_comments_admin_overview_submit in Heartbeat 7

Same name and namespace in other branches
  1. 6.4 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 106
Admin page callbacks for the heartbeat comments module.

Code

function heartbeat_comments_admin_overview_submit($form, &$form_state) {
  if ($form_state['values']['operation'] == 'delete') {
    $cids = array();
    foreach ($form_state['values']['heartbeat_comments'] as $cid => $value) {
      if ($value) {
        _heartbeat_comments_delete($cid);

        // Add an entry to the watchdog log.
        watchdog('content', 'Heartbeat comment: deleted %id.', array(
          '%id' => $cid,
        ), WATCHDOG_NOTICE);
      }
    }
    drupal_set_message(t('The update has been performed.'));
    $form_state['redirect'] = 'admin/content/heartbeat/comments';
  }
}