From eabc4bd2d37567532d4adba56054f3a0cce39462 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 5 Jan 2010 15:30:30 +0000 Subject: [PATCH] - Patch #673974 by sun: Fixed PHP notice when mass-unpublishing or deleting comments, and wrong form validation redirect. --- modules/comment/comment.admin.inc | 3 +-- modules/comment/comment.module | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/comment/comment.admin.inc b/modules/comment/comment.admin.inc index 59a9717f851..9c773dec5e1 100644 --- a/modules/comment/comment.admin.inc +++ b/modules/comment/comment.admin.inc @@ -134,7 +134,6 @@ function comment_admin_overview_validate($form, &$form_state) { // We can't execute any 'Update options' if no comments were selected. if (count($form_state['values']['comments']) == 0) { form_set_error('', t('Please select one or more comments to perform the update on.')); - drupal_goto('admin/content/comment'); } } @@ -146,7 +145,7 @@ function comment_admin_overview_validate($form, &$form_state) { */ function comment_admin_overview_submit($form, &$form_state) { $operations = comment_operations(); - if ($operations[$form_state['values']['operation']][1]) { + if (!empty($operations[$form_state['values']['operation']][1])) { // Extract the appropriate database query operation. $query = $operations[$form_state['values']['operation']][1]; foreach ($form_state['values']['comments'] as $cid => $value) { diff --git a/modules/comment/comment.module b/modules/comment/comment.module index afcd985d87c..444ed9d8025 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1467,21 +1467,21 @@ function comment_delete_multiple($cids) { function comment_operations($action = NULL) { if ($action == 'publish') { $operations = array( - 'publish' => array(t('Publish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_PUBLISHED)) ), - 'delete' => array(t('Delete the selected comments'), '') + 'publish' => array(t('Publish the selected comments'), db_update('comment')->fields(array('status' => COMMENT_PUBLISHED))), + 'delete' => array(t('Delete the selected comments'), ''), ); } elseif ($action == 'unpublish') { $operations = array( - 'unpublish' => array(t('Unpublish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_NOT_PUBLISHED)) ), - 'delete' => array(t('Delete the selected comments'), '') + 'unpublish' => array(t('Unpublish the selected comments'), db_update('comment')->fields(array('status' => COMMENT_NOT_PUBLISHED))), + 'delete' => array(t('Delete the selected comments'), ''), ); } else { $operations = array( - 'publish' => array(t('Publish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_PUBLISHED)) ), - 'unpublish' => array(t('Unpublish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_NOT_PUBLISHED)) ), - 'delete' => array(t('Delete the selected comments'), '') + 'publish' => array(t('Publish the selected comments'), db_update('comment')->fields(array('status' => COMMENT_PUBLISHED))), + 'unpublish' => array(t('Unpublish the selected comments'), db_update('comment')->fields(array('status' => COMMENT_NOT_PUBLISHED))), + 'delete' => array(t('Delete the selected comments'), ''), ); }