summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-11-02 01:00:42 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-11-02 01:00:42 +0000
commitd27539613f476c8c2e2d5a63ab5aecf362fcfdd4 (patch)
tree9e9ffdee20b58aff63091d1cc250892a8d304115
parentab91113c56366dc30deaba00bfed0b9b22b58b22 (diff)
downloadbrdo-d27539613f476c8c2e2d5a63ab5aecf362fcfdd4.tar.gz
brdo-d27539613f476c8c2e2d5a63ab5aecf362fcfdd4.tar.bz2
#537056 by catch and dww: Fixed Broken drupal_static() conversion in theme_comment_post_forbidden().
-rw-r--r--modules/comment/comment.module12
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index e3dc798b1..119b494ea 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -2188,10 +2188,16 @@ function theme_comment_post_forbidden($variables) {
$node = $variables['node'];
global $user;
+ // Since this is expensive to compute, we cache it so that a page with many
+ // comments only has to query the database once for all the links.
+ $authenticated_post_comments = &drupal_static(__FUNCTION__, NULL);
+
if (!$user->uid) {
- // We only output any link if we are certain, that users get permission
- // to post comments by logging in. We also locally cache this information.
- $authenticated_post_comments = &drupal_static(__FUNCTION__, array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval')));
+ 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'));
+ }
if ($authenticated_post_comments) {
// We cannot use drupal_get_destination() because these links