Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.544 diff -u -p -r1.544 comment.module --- modules/comment/comment.module 20 May 2007 07:30:03 -0000 1.544 +++ modules/comment/comment.module 22 May 2007 22:32:34 -0000 @@ -1117,8 +1117,17 @@ function comment_delete($cid = NULL) { } function comment_confirm_delete($comment) { - $form = array(); $form['#comment'] = $comment; + + // Offer option to ban author at the same time. + if ($comment->uid > 1) { + $form['ban'] = array( + '#type' => 'checkbox', + '#title' => t('Also ban author %name', array('%name' => $comment->name)), + '#access' => user_access('ban users'), + ); + } + return confirm_form( $form, t('Are you sure you want to delete the comment %title?', array('%title' => $comment->subject)), @@ -1130,6 +1139,12 @@ function comment_confirm_delete($comment } function comment_confirm_delete_submit($form_values, $form, &$form_state) { + if (!empty($form_values['ban'])) { + $account = user_load($form['#comment']->uid); + user_save($account, array('status' => 0)); + drupal_set_message(t('User %name has been banned.', array('%name' => $account->name))); + } + drupal_set_message(t('The comment and all its replies have been deleted.')); $comment = $form['#comment']; Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.818 diff -u -p -r1.818 node.module --- modules/node/node.module 22 May 2007 05:52:16 -0000 1.818 +++ modules/node/node.module 22 May 2007 22:32:37 -0000 @@ -2354,25 +2354,46 @@ function node_form_submit($form_values, * Menu callback -- ask for confirmation of node deletion */ function node_delete_confirm($node) { - $form['nid'] = array('#type' => 'value', '#value' => $node->nid); + $form['nid'] = array( + '#type' => 'value', + '#value' => $node->nid, + ); - return confirm_form($form, - t('Are you sure you want to delete %title?', array('%title' => $node->title)), - isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid, - t('This action cannot be undone.'), - t('Delete'), t('Cancel')); + // Offer option to ban author at the same time. + if ($node->uid > 1) { + $form['uid'] = array( + '#type' => 'value', + '#value' => $node->uid, + ); + $form['ban'] = array( + '#type' => 'checkbox', + '#title' => t('Also ban author %name', array('%name' => $node->name)), + '#access' => user_access('ban users'), + ); + } + + return confirm_form($form, + t('Are you sure you want to delete %title?', array('%title' => $node->title)), + isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid, + t('This action cannot be undone.'), + t('Delete'), t('Cancel')); } /** * Execute node deletion */ function node_delete_confirm_submit($form_values, $form, &$form_state) { + if (!empty($form_values['ban'])) { + $account = user_load($form_values['uid']); + user_save($account, array('status' => 0)); + drupal_set_message(t('User %name has been banned.', array('%name' => $account->name))); + } + if ($form_values['confirm']) { node_delete($form_values['nid']); } $form_state['redirect'] = ''; - return; } /** Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.785 diff -u -p -r1.785 user.module --- modules/user/user.module 22 May 2007 05:52:17 -0000 1.785 +++ modules/user/user.module 22 May 2007 22:32:40 -0000 @@ -455,7 +455,7 @@ function user_fields() { * Implementation of hook_perm(). */ function user_perm() { - return array('administer access control', 'administer users', 'access user profiles', 'change own username'); + return array('administer access control', 'administer users', 'access user profiles', 'change own username', 'ban users'); } /**