=== modified file 'modules/comment/comment.admin.inc' --- modules/comment/comment.admin.inc 2008-12-06 09:01:58 +0000 +++ modules/comment/comment.admin.inc 2008-12-07 21:42:29 +0000 @@ -269,6 +269,15 @@ 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') || user_access('administer users'), + ); + } + return confirm_form( $form, t('Are you sure you want to delete the comment %title?', array('%title' => $comment->subject)), @@ -283,6 +292,11 @@ * 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. === modified file 'modules/node/node.pages.inc' --- modules/node/node.pages.inc 2008-12-06 09:01:58 +0000 +++ modules/node/node.pages.inc 2008-12-07 21:34:36 +0000 @@ -480,6 +480,19 @@ '#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') || user_access('administer 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 @@ * 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']); } === modified file 'modules/user/user.module' --- modules/user/user.module 2008-12-06 09:01:58 +0000 +++ modules/user/user.module 2008-12-07 21:34:39 +0000 @@ -568,24 +568,28 @@ * Implementation of hook_perm(). */ function user_perm() { - return array( - 'administer permissions' => array( - 'title' => t('Administer permissions'), - 'description' => t('Manage the permissions assigned to user roles. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), - ), - 'administer users' => array( - 'title' => t('Administer users'), - 'description' => t('Manage or block users, and manage their role assignments.'), - ), - 'access user profiles' => array( - 'title' => t('Access user profiles'), - 'description' => t('View profiles of users on the site, which may contain personal information.'), - ), - 'change own username' => array( - 'title' => t('Change own username'), - 'description' => t('Select a different username.'), - ), - ); + return array( + 'administer permissions' => array( + 'title' => t('Administer permissions'), + 'description' => t('Manage the permissions assigned to user roles. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), + ), + 'administer users' => array( + 'title' => t('Administer users'), + 'description' => t('Manage or block users, and manage their role assignments.'), + ), + 'access user profiles' => array( + 'title' => t('Access user profiles'), + 'description' => t('View profiles of users on the site, which may contain personal information.'), + ), + 'change own username' => array( + '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.'), + ), + ); } /**