From cb8201c337c293cc7dd7f9a25579f18d4549324b Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Sun, 17 Sep 2006 19:09:34 +0000 Subject: [PATCH] - Patch #83007 by edkwh: fixed multi-comment delete. --- modules/comment/comment.module | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 1676d0e086d9..5da54b2f258c 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -102,8 +102,7 @@ function comment_menu($may_cache) { 'path' => 'admin/content/comment', 'title' => t('comments'), 'description' => t('List and edit site comments and the comment moderation queue.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('comment_admin_overview'), + 'callback' => 'comment_admin', 'access' => $access ); @@ -115,8 +114,8 @@ function comment_menu($may_cache) { $items[] = array('path' => 'admin/content/comment/list/new', 'title' => t('published comments'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); $items[] = array('path' => 'admin/content/comment/list/approval', 'title' => t('approval queue'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('comment_admin_overview', 'approval'), + 'callback' => 'comment_admin', + 'callback arguments' => array('approval'), 'access' => $access, 'type' => MENU_LOCAL_TASK); @@ -1000,20 +999,25 @@ function comment_operations($action = NULL) { /** * Menu callback; present an administrative comment listing. */ -function comment_admin_overview($type = 'new') { +function comment_admin($type = 'new') { $edit = $_POST; if ($edit['operation'] == 'delete') { - return comment_multiple_delete_confirm(); + return drupal_get_form('comment_multiple_delete_confirm'); + } + else { + return drupal_get_form('comment_admin_overview', $type, arg(4)); } +} +function comment_admin_overview($type = 'new', $arg) { // build an 'Update options' form $form['options'] = array( '#type' => 'fieldset', '#title' => t('Update options'), '#prefix' => '<div class="container-inline">', '#suffix' => '</div>' ); $options = array(); - foreach (comment_operations(arg(4) == 'approval' ? 'publish' : 'unpublish') as $key => $value) { + foreach (comment_operations($arg == 'approval' ? 'publish' : 'unpublish') as $key => $value) { $options[$key] = $value[0]; } $form['options']['operation'] = array('#type' => 'select', '#options' => $options, '#default_value' => 'publish'); @@ -1146,8 +1150,8 @@ function comment_multiple_delete_confirm() { * Perform the actual comment deletion. */ function comment_multiple_delete_confirm_submit($form_id, $form_values) { - if ($edit['confirm']) { - foreach ($edit['comments'] as $cid => $value) { + if ($form_values['confirm']) { + foreach ($form_values['comments'] as $cid => $value) { $comment = _comment_load($cid); _comment_delete_thread($comment); _comment_update_node_statistics($comment->nid); -- GitLab