You are here

function reviews_list_confirm_delete_submit in Reviews 7

This function deletes the selected reviews.

1 call to reviews_list_confirm_delete_submit()
reviews_list_submit in includes/reviews.admin.inc
Confirm handler for review_list form.

File

includes/reviews.admin.inc, line 284
This file contains all the functions necessary for the admin pages of the reviews system.

Code

function reviews_list_confirm_delete_submit($form, $form_state) {
  $reviews = $form_state['values']['reviews'];
  foreach ($reviews as $key => $review) {
    $nid = reviews_get_nid_from_rid($review);
    db_delete('reviews')
      ->condition('rid', $review, '=')
      ->execute();
    if ($nid) {
      reviews_update_review_count_for_node($nid);
    }
  }
  drupal_set_message(t('The selected reviews have been deleted.'), 'status');
}