commit b8e4afb8a932bc0cace2234facd9956c435551be Author: Lee Rowlands Date: Tue Apr 9 07:44:27 2013 +1000 [#conditions] Patch 28 diff --git a/core/lib/Drupal/Core/Entity/Field/Type/EntityWrapper.php b/core/lib/Drupal/Core/Entity/Field/Type/EntityWrapper.php index a61af67..3b5956d 100644 --- a/core/lib/Drupal/Core/Entity/Field/Type/EntityWrapper.php +++ b/core/lib/Drupal/Core/Entity/Field/Type/EntityWrapper.php @@ -67,8 +67,9 @@ public function __construct(array $definition, $name = NULL, ContextAwareInterfa public function getValue() { $source = $this->getIdSource(); $id = $source ? $source->getValue() : $this->id; - // If $id is numeric, trust that it is correct. - return $id || is_numeric($id) ? entity_load($this->entityType, $id) : NULL; + // If $id is numeric, trust that it is correct, this allows it to work for + // anonymous users ($id = 0). + return ($id || is_numeric($id)) ? entity_load($this->entityType, $id) : NULL; } /** diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index b58df64..7c93427 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1609,6 +1609,9 @@ function comment_preprocess_block(&$variables) { function comment_prepare_author(Comment $comment) { // The account has been pre-loaded by CommentRenderController::buildContent(). $account = $comment->uid->entity; + // For an anonymous commenter, name and homepage are stored in the comment, + // to make them available for rendering in the author object we need to + // transpose these values into the $account object. $anonymous_fields = array('name', 'homepage'); if ($account->uid == 0) { // Make sure that correct anonymous fields are set if provided.