Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.563 diff -u -p -r1.563 comment.module --- modules/comment/comment.module 5 Jul 2007 08:48:57 -0000 1.563 +++ modules/comment/comment.module 5 Jul 2007 22:48:28 -0000 @@ -1115,8 +1115,17 @@ function comment_delete($cid = NULL) { } function comment_confirm_delete(&$form_state, $comment) { - $form = array(); $form['#comment'] = $comment; + + // Offer option to block author at the same time. + if ($comment->uid > 1) { + $form['block'] = array( + '#type' => 'checkbox', + '#title' => t('Also block author %name', array('%name' => $comment->name)), + '#access' => user_access('block users'), + ); + } + return confirm_form( $form, t('Are you sure you want to delete the comment %title?', array('%title' => $comment->subject)), @@ -1128,6 +1137,12 @@ function comment_confirm_delete(&$form_s } function comment_confirm_delete_submit($form, &$form_state) { + if (!empty($form_state['values']['block'])) { + $account = user_load($form['#comment']->uid); + user_save($account, array('status' => 0)); + drupal_set_message(t('User %name has been blocked.', 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.853 diff -u -p -r1.853 node.module --- modules/node/node.module 5 Jul 2007 08:48:57 -0000 1.853 +++ modules/node/node.module 5 Jul 2007 22:53:23 -0000 @@ -2470,6 +2470,19 @@ function node_form_submit($form, &$form_ function node_delete_confirm(&$form_state, $node) { $form['nid'] = array('#type' => 'value', '#value' => $node->nid); + // Offer option to block author at the same time. + if ($node->uid > 1) { + $form['uid'] = array( + '#type' => 'value', + '#value' => $node->uid, + ); + $form['block'] = array( + '#type' => 'checkbox', + '#title' => t('Also block author %name', array('%name' => $node->name)), + '#access' => user_access('block 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, @@ -2481,12 +2494,17 @@ function node_delete_confirm(&$form_stat * Execute node deletion */ function node_delete_confirm_submit($form, &$form_state) { + if (!empty($form_state['values']['block'])) { + $account = user_load($form_state['values']['uid']); + user_save($account, array('status' => 0)); + drupal_set_message(t('User %name has been blocked.', array('%name' => $account->name))); + } + if ($form_state['values']['confirm']) { node_delete($form_state['values']['nid']); } $form_state['redirect'] = ''; - return; } /** Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.818 diff -u -p -r1.818 user.module --- modules/user/user.module 5 Jul 2007 08:48:58 -0000 1.818 +++ modules/user/user.module 5 Jul 2007 22:48:32 -0000 @@ -489,7 +489,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', 'block users'); } /**