diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 10df685fefece318780409c9c4001db686906499..6a3cc884bc015c9c350605e91f21fabab862a0b2 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -82,8 +82,8 @@ function comment_help($path, $arg) { $output .= '
'; $output .= '
' . t('Default and custom settings') . '
'; $output .= '
' . t("Each content type can have its own default comment settings configured as: Open to allow new comments, Hidden to hide existing comments and prevent new comments, or Closed to view existing comments, but prevent new comments. These defaults will apply to all new content created (changes to the settings on existing content must be done manually). Other comment settings can also be customized per content type, and can be overridden for any given item of content. When a comment has no replies, it remains editable by its author, as long as the author has a user account and is logged in.", array('@content-type' => url('admin/structure/types'))) . '
'; - $output .= '
' . t('Comment moderation') . '
'; - $output .= '
' . t("Comments from users who do not have the Post comments without approval permission are placed in the Unapproved comments queue, until a user who has permission to Administer comments moderates them as either published or deleted. Published comments can be bulk managed on the Published comments administration page.", array('@comment-approval' => url('admin/content/comment/approval'), '@admin-comment' => url('admin/content/comment'))) . '
'; + $output .= '
' . t('Comment approval') . '
'; + $output .= '
' . t("Comments from users who have the Skip comment approval permission are published immediately. All other comments are placed in the Unapproved comments queue, until a user who has permission to Administer comments publishes or deletes them. Published comments can be bulk managed on the Published comments administration page.", array('@comment-approval' => url('admin/content/comment/approval'), '@admin-comment' => url('admin/content/comment'))) . '
'; $output .= '
'; return $output; } @@ -386,10 +386,10 @@ function comment_permission() { 'title' => t('View comments'), ), 'post comments' => array( - 'title' => t('Post comments with approval'), + 'title' => t('Post comments'), ), - 'post comments without approval' => array( - 'title' => t('Post comments without approval'), + 'skip comment approval' => array( + 'title' => t('Skip comment approval'), ), 'edit own comments' => array( 'title' => t('Edit own comments'), @@ -1421,7 +1421,7 @@ function comment_save($comment) { 'mail' => '', 'homepage' => '', 'name' => '', - 'status' => user_access('post comments without approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED, + 'status' => user_access('skip comment approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED, ); foreach ($defaults as $key => $default) { if (!isset($comment->$key)) { @@ -1867,7 +1867,7 @@ function comment_form($form, &$form_state, $comment) { else { $author = ($comment->name ? $comment->name : variable_get('anonymous', t('Anonymous'))); } - $status = (user_access('post comments without approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED); + $status = (user_access('skip comment approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED); $date = ''; } @@ -2282,7 +2282,7 @@ function theme_comment_post_forbidden($variables) { if (!isset($authenticated_post_comments)) { // We only output a link if we are certain that users will get permission // to post comments by logging in. - $authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval')); + $authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'skip comment approval')); } if ($authenticated_post_comments) { diff --git a/modules/comment/comment.test b/modules/comment/comment.test index 2515a96936d295ea9cf4835562a364db8bb8b484..57af9e562be2f37af20ea7920984a207155ddd4b 100644 --- a/modules/comment/comment.test +++ b/modules/comment/comment.test @@ -440,7 +440,7 @@ class CommentPreviewTest extends CommentHelperCase { */ function testCommentEditPreview() { $langcode = LANGUAGE_NONE; - $web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'post comments without approval')); + $web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'skip comment approval')); $this->drupalLogin($this->admin_user); $this->setCommentPreview(DRUPAL_OPTIONAL); $this->setCommentForm(TRUE); @@ -495,7 +495,7 @@ class CommentAnonymous extends CommentHelperCase { user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( 'access comments' => TRUE, 'post comments' => TRUE, - 'post comments without approval' => TRUE, + 'skip comment approval' => TRUE, )); $this->setCommentAnonymous('0'); // Ensure that doesn't require contact info. $this->drupalLogout(); @@ -579,7 +579,7 @@ class CommentAnonymous extends CommentHelperCase { user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( 'access comments' => FALSE, 'post comments' => FALSE, - 'post comments without approval' => FALSE, + 'skip comment approval' => FALSE, )); // Attempt to view comments while disallowed. @@ -598,7 +598,7 @@ class CommentAnonymous extends CommentHelperCase { user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( 'access comments' => TRUE, 'post comments' => FALSE, - 'post comments without approval' => FALSE, + 'skip comment approval' => FALSE, )); $this->drupalGet('node/' . $this->node->nid); $this->assertPattern('/
]*?)id="comments"([^>]*?)>/', t('Comments were displayed.')); @@ -890,7 +890,7 @@ class CommentApprovalTest extends CommentHelperCase { user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( 'access comments' => TRUE, 'post comments' => TRUE, - 'post comments without approval' => FALSE, + 'skip comment approval' => FALSE, )); $this->drupalLogin($this->admin_user); $this->setCommentAnonymous('0'); // Ensure that doesn't require contact info. @@ -959,7 +959,7 @@ class CommentApprovalTest extends CommentHelperCase { user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( 'access comments' => TRUE, 'post comments' => TRUE, - 'post comments without approval' => FALSE, + 'skip comment approval' => FALSE, )); $this->drupalLogin($this->admin_user); $this->setCommentAnonymous('0'); // Ensure that doesn't require contact info. diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test index e3287a51198db23427223f9847f142955b447d66..4cab590ac77ab0c6214c641d18ec5d9e4a7f64b5 100644 --- a/modules/rdf/rdf.test +++ b/modules/rdf/rdf.test @@ -411,7 +411,7 @@ class RdfCommentAttributesTestCase extends CommentHelperCase { user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array( 'access comments' => TRUE, 'post comments' => TRUE, - 'post comments without approval' => TRUE, + 'skip comment approval' => TRUE, )); // Allows anonymous to leave their contact information. $this->setCommentAnonymous(COMMENT_ANONYMOUS_MAY_CONTACT); @@ -569,7 +569,7 @@ class RdfTrackerAttributesTestCase extends DrupalWebTestCase { 'create article content' => TRUE, 'access comments' => TRUE, 'post comments' => TRUE, - 'post comments without approval' => TRUE, + 'skip comment approval' => TRUE, )); } diff --git a/modules/search/search.test b/modules/search/search.test index 29fa9ef3f5dc6a3a8aeb8fc100feb88b9e78ec83..f0d3a6a4b4fa770f1ecd14479713c604a9396957 100644 --- a/modules/search/search.test +++ b/modules/search/search.test @@ -363,7 +363,7 @@ class SearchRankingTestCase extends DrupalWebTestCase { function testRankings() { // Login with sufficient privileges. - $this->drupalLogin($this->drupalCreateUser(array('post comments without approval', 'create page content'))); + $this->drupalLogin($this->drupalCreateUser(array('skip comment approval', 'create page content'))); // Build a list of the rankings to test. $node_ranks = array('sticky', 'promote', 'relevance', 'recent', 'comments', 'views'); @@ -518,7 +518,7 @@ class SearchRankingTestCase extends DrupalWebTestCase { */ function testDoubleRankings() { // Login with sufficient privileges. - $this->drupalLogin($this->drupalCreateUser(array('post comments without approval', 'create page content'))); + $this->drupalLogin($this->drupalCreateUser(array('skip comment approval', 'create page content'))); // See testRankings() above - build a node that will rank high for sticky. $settings = array( @@ -695,7 +695,7 @@ class SearchCommentTestCase extends DrupalWebTestCase { filter_permission_name($full_html_format), 'administer permissions', 'create page content', - 'post comments without approval', + 'skip comment approval', 'access comments', ); $this->admin_user = $this->drupalCreateUser($permissions); @@ -949,7 +949,7 @@ class SearchCommentCountToggleTestCase extends DrupalWebTestCase { parent::setUp('search'); // Create searching user. - $this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'post comments without approval')); + $this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'skip comment approval')); // Create initial nodes. $node_params = array('type' => 'article', 'body' => array(LANGUAGE_NONE => array(array('value' => 'SearchCommentToggleTestCase')))); @@ -1082,7 +1082,7 @@ class SearchKeywordsConditions extends DrupalWebTestCase { function setUp() { parent::setUp('search', 'search_extra_type'); // Create searching user. - $this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'post comments without approval')); + $this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'skip comment approval')); // Login with sufficient privileges. $this->drupalLogin($this->searching_user); // Test with all search modules enabled. diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index a8692464bb98559dff77a3c9e301ab81a219a657..997eaaba1d033c7a7072ccb3fbb044d7ca58867e 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -991,7 +991,7 @@ protected function drupalCompareFiles($file1, $file2) { * A fully loaded user object with pass_raw property, or FALSE if account * creation fails. */ - protected function drupalCreateUser($permissions = array('access comments', 'access content', 'post comments', 'post comments without approval')) { + protected function drupalCreateUser($permissions = array('access comments', 'access content', 'post comments', 'skip comment approval')) { // Create a role with the given permission set. if (!($rid = $this->drupalCreateRole($permissions))) { return FALSE; diff --git a/modules/tracker/tracker.test b/modules/tracker/tracker.test index 12dc9d48df7406780b0e446742061e2682b9b1ce..c0233085c09acb5a54ca64e048a084493456f90b 100644 --- a/modules/tracker/tracker.test +++ b/modules/tracker/tracker.test @@ -17,7 +17,7 @@ class TrackerTest extends DrupalWebTestCase { function setUp() { parent::setUp('comment', 'tracker'); - $permissions = array('access comments', 'create page content', 'post comments', 'post comments without approval'); + $permissions = array('access comments', 'create page content', 'post comments', 'skip comment approval'); $this->user = $this->drupalCreateUser($permissions); $this->other_user = $this->drupalCreateUser($permissions); diff --git a/modules/trigger/trigger.test b/modules/trigger/trigger.test index 6d60eda9e6d1be66f0d45b9e2c43334795478580..a9fbffec36ce4111be08f95f4fe381f409aaffab 100644 --- a/modules/trigger/trigger.test +++ b/modules/trigger/trigger.test @@ -495,7 +495,7 @@ class TriggerUserActionTestCase extends TriggerActionTestCase { * Tests user action assignment and execution. */ function testUserActionAssignmentExecution() { - $test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'post comments without approval', 'edit own comments')); + $test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'skip comment approval', 'edit own comments')); $this->drupalLogin($test_user); $triggers = array('comment_presave', 'comment_insert', 'comment_update'); @@ -517,7 +517,7 @@ class TriggerUserActionTestCase extends TriggerActionTestCase { // the comment is updated. user_save($account, array('status' => TRUE)); - $test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'post comments without approval', 'edit own comments')); + $test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'skip comment approval', 'edit own comments')); $this->drupalLogin($test_user); // Our original comment will have been comment 1. @@ -526,7 +526,7 @@ class TriggerUserActionTestCase extends TriggerActionTestCase { $this->assertTrue($comment_author_account->status == 0, t('Comment author account (uid=@uid) is blocked after update to comment', array('@uid' => $comment_author_uid))); // Verify that the comment was updated. - $test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'post comments without approval', 'edit own comments')); + $test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'skip comment approval', 'edit own comments')); $this->drupalLogin($test_user); $this->drupalGet("node/$node->nid"); @@ -627,7 +627,7 @@ class TriggerOtherTestCase extends TriggerWebTestCase { variable_set($action_id, FALSE); // Create a node and add a comment to it. - $web_user = $this->drupalCreateUser(array('create article content', 'access content', 'post comments without approval', 'post comments')); + $web_user = $this->drupalCreateUser(array('create article content', 'access content', 'skip comment approval', 'post comments')); $this->drupalLogin($web_user); $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1)); $edit = array(); diff --git a/modules/user/user.install b/modules/user/user.install index 00afd2dc014945a641a9a144083062740dee3bff..9d5256e6239498be07dc546c4390aed471966c82 100644 --- a/modules/user/user.install +++ b/modules/user/user.install @@ -823,6 +823,20 @@ function user_update_7013(&$sandbox) { $sandbox['#finished'] = empty($sandbox['max']) || ($sandbox['progress'] / $sandbox['max']); } +/** + * Rename the 'post comments without approval' permission. + * + * In Drupal 7, this permission has been renamed to 'skip comment approval'. + */ +function user_update_7014() { + db_update('role_permission') + ->fields(array('permission' => 'skip comment approval')) + ->condition('permission', 'post comments without approval') + ->execute(); + + return t("Renamed the 'post comments without approval' permission to 'skip comment approval'."); +} + /** * @} End of "defgroup user-updates-6.x-to-7.x" * The next series of updates should start at 8000. diff --git a/modules/user/user.test b/modules/user/user.test index cbde24b713e6f106d08a0625c996daa01211e652..91549f0de3b00574f18c184b06486aa7527b8224 100644 --- a/modules/user/user.test +++ b/modules/user/user.test @@ -571,7 +571,7 @@ class UserCancelTestCase extends DrupalWebTestCase { variable_set('user_cancel_method', 'user_cancel_delete'); // Create a user. - $account = $this->drupalCreateUser(array('cancel account', 'post comments', 'post comments without approval')); + $account = $this->drupalCreateUser(array('cancel account', 'post comments', 'skip comment approval')); $this->drupalLogin($account); // Load real user object. $account = user_load($account->uid, TRUE); diff --git a/profiles/standard/standard.install b/profiles/standard/standard.install index 745c43b3742675b84d930d7f7ee9785d61c9f1dc..74b66a2524fa151128ddae33f7c360c32cdab09e 100644 --- a/profiles/standard/standard.install +++ b/profiles/standard/standard.install @@ -401,7 +401,7 @@ function standard_install() { // Enable default permissions for system roles. $filtered_html_permission = filter_permission_name($filtered_html_format); user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', 'access comments', $filtered_html_permission)); - user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', 'access comments', 'post comments', 'post comments without approval', $filtered_html_permission)); + user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', 'access comments', 'post comments', 'skip comment approval', $filtered_html_permission)); // Create a default role for site administrators, with all available permissions assigned. $admin_role = new stdClass();