Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.588 diff -u -p -r1.588 comment.module --- modules/comment/comment.module 8 Oct 2007 14:22:31 -0000 1.588 +++ modules/comment/comment.module 11 Oct 2007 12:19:16 -0000 @@ -1141,8 +1141,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)), @@ -1154,6 +1163,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.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.5 diff -u -p -r1.5 node.pages.inc --- modules/node/node.pages.inc 5 Oct 2007 13:14:04 -0000 1.5 +++ modules/node/node.pages.inc 11 Oct 2007 12:19:18 -0000 @@ -431,6 +431,19 @@ function node_form_submit_build_node($fo 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, @@ -442,12 +455,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.852 diff -u -p -r1.852 user.module --- modules/user/user.module 7 Oct 2007 19:27:40 -0000 1.852 +++ modules/user/user.module 11 Oct 2007 12:19:20 -0000 @@ -497,7 +497,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'); } /**