Index: modules/comment/comment.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v retrieving revision 1.10 diff -u -p -r1.10 comment.admin.inc --- modules/comment/comment.admin.inc 16 Jul 2008 21:59:26 -0000 1.10 +++ modules/comment/comment.admin.inc 18 Oct 2008 03:17:56 -0000 @@ -265,8 +265,16 @@ function comment_delete($cid = NULL) { * @see comment_confirm_delete_submit() */ 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)), @@ -281,6 +289,11 @@ function comment_confirm_delete(&$form_s * Process comment_confirm_delete form submissions. */ 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']; // Delete the comment and its replies. Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.45 diff -u -p -r1.45 node.pages.inc --- modules/node/node.pages.inc 13 Oct 2008 00:33:03 -0000 1.45 +++ modules/node/node.pages.inc 18 Oct 2008 03:17:56 -0000 @@ -480,6 +480,19 @@ function node_delete_confirm(&$form_stat '#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, @@ -493,6 +506,12 @@ 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']); } Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.928 diff -u -p -r1.928 user.module --- modules/user/user.module 12 Oct 2008 04:30:09 -0000 1.928 +++ modules/user/user.module 18 Oct 2008 03:17:56 -0000 @@ -587,6 +587,10 @@ function user_perm() { 'title' => t('Change own username'), 'description' => t('Select a different username.'), ), + 'block users' => array( + 'title' => t('Block users'), + 'description' => t('Block users from the site.'), + ), ); }