? .cache ? .project ? .settings ? block_author_on_delete_0.patch ? taxonomy_term_delete_1.patch ? sites/sqlite.drupal7 ? sites/sub.drupal7 ? sites/all/modules ? sites/all/themes ? sites/default/files ? sites/default/settings.php Index: modules/comment/comment.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v retrieving revision 1.12 diff -u -p -r1.12 comment.admin.inc --- modules/comment/comment.admin.inc 3 Dec 2008 16:32:21 -0000 1.12 +++ modules/comment/comment.admin.inc 25 Dec 2008 14:04:20 -0000 @@ -269,6 +269,15 @@ 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') || 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 @@ 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.47 diff -u -p -r1.47 node.pages.inc --- modules/node/node.pages.inc 16 Dec 2008 22:05:51 -0000 1.47 +++ modules/node/node.pages.inc 25 Dec 2008 14:04:23 -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') || 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 @@ 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.949 diff -u -p -r1.949 user.module --- modules/user/user.module 23 Dec 2008 14:18:31 -0000 1.949 +++ modules/user/user.module 25 Dec 2008 14:04:29 -0000 @@ -570,24 +570,28 @@ function user_is_blocked($name) { * 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.'), + ), + ); } /**