diff -u b/core/modules/comment/comment.module b/core/modules/comment/comment.module --- b/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1536,8 +1536,7 @@ 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. - $comment_roles = user_roles(TRUE, 'post comments'); - $authenticated_post_comments = isset($comment_roles[DRUPAL_AUTHENTICATED_RID]); + $authenticated_post_comments = user_role_has_permission(DRUPAL_AUTHENTICATED_RID, 'post comments'); } if ($authenticated_post_comments) { @@ -1606,7 +1605,8 @@ 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 = user_role_has_permission(DRUPAL_AUTHENTICATED_RID, 'post comments'); + $comment_roles = user_roles(TRUE, 'post comments'); + $authenticated_post_comments = isset($comment_roles[DRUPAL_AUTHENTICATED_RID]); } if ($authenticated_post_comments) { diff -u b/core/modules/forum/forum.module b/core/modules/forum/forum.module --- b/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -177,7 +177,7 @@ // Anonymous user does not have access to create new topics. else { // If authenticated users can post new topic, provide a login link. - if (user_role_has_permission(DRUPAL_AUTHENTICATED_RID, 'create forum content')) { + if (user_role_load(DRUPAL_AUTHENTICATED_RID)->hasPermission('create forum content')) { $links['login'] = array( '#theme' => 'menu_local_action', '#link' => array( reverted: --- b/core/modules/user/user.module +++ a/core/modules/user/user.module @@ -2026,20 +2026,3 @@ // Destroy the current session, and reset $user to the anonymous user. session_destroy(); } - -/** - * Determines whether a role has given permission. - * @param string $rid - * role IDs of interest - * @param string $permission - * A string containing a permission. - * - * @return boolean - * TRUE if the given role has the requested permission. - */ -function user_role_has_permission($rid, $permission) { - // Get permissions of role given by ID. - $perms = user_role_permissions(array($rid => $rid)); - // Returns TRUE if the role has the requested permission. - return in_array($permission, $perms[$rid]); -}