diff --git a/core/includes/update.inc b/core/includes/update.inc index 5b045f6..2bbc9ff 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -499,7 +499,11 @@ function update_fix_d8_requirements() { global $conf; if (drupal_get_installed_schema_version('system') < 8000 && !update_variable_get('update_d8_requirements', FALSE)) { - // @todo: Make critical, first-run changes to the database here. + + // Make sure that file.module is enabled as it is required for the user + // picture upgrade path. + update_module_enable(array('file')); + update_variable_set('update_d8_requirements', TRUE); } } diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index e700723..38adbd0 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1599,7 +1599,6 @@ function comment_preview(Comment $comment) { $comment->name = check_plain($account->name); $comment->signature = $account->signature; $comment->signature_format = $account->signature_format; - $comment->picture = $account->picture; } elseif (empty($comment->name)) { $comment->name = config('user.settings')->get('anonymous'); @@ -1655,7 +1654,14 @@ function template_preprocess_comment(&$variables) { $variables['changed'] = format_date($comment->changed); $variables['new'] = !empty($comment->new) ? t('new') : ''; - $variables['user_picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', array('account' => $comment)) : ''; + if (theme_get_setting('toggle_comment_user_picture')) { + // To change user picture settings (e.g., image style), edit the 'compact' + // view mode on the User entity. + $variables['user_picture'] = user_view($comment->account, 'compact'); + } + else { + $variables['user_picture'] = array(); + } $variables['signature'] = $comment->signature; $uri = $comment->uri(); diff --git a/core/modules/comment/lib/Drupal/comment/CommentRenderController.php b/core/modules/comment/lib/Drupal/comment/CommentRenderController.php index c614f8e..bc21cd2 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentRenderController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentRenderController.php @@ -27,6 +27,9 @@ public function buildContent(array $entities = array(), $view_mode = 'full', $la return $return; } + // Attach user account. + user_attach_accounts($entities); + parent::buildContent($entities, $view_mode, $langcode); foreach ($entities as $entity) { diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php index 4d447a5..50dde39 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php @@ -34,7 +34,7 @@ protected function buildQuery($ids, $revision_id = FALSE) { $query->addField('n', 'type', 'node_type'); $query->innerJoin('users', 'u', 'base.uid = u.uid'); $query->addField('u', 'name', 'registered_name'); - $query->fields('u', array('uid', 'signature', 'signature_format', 'picture')); + $query->fields('u', array('uid', 'signature', 'signature_format')); return $query; } diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php index 44a38d5..0738076 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php @@ -44,12 +44,11 @@ function testCommentPreview() { // Login as web user and add a signature and a user picture. $this->drupalLogin($this->web_user); config('user.settings')->set('signatures', 1)->save(); - variable_set('user_pictures', 1); $test_signature = $this->randomName(); $edit['signature[value]'] = '' . $test_signature. ''; $edit['signature[format]'] = 'filtered_html'; $image = current($this->drupalGetTestFiles('image')); - $edit['files[picture_upload]'] = drupal_realpath($image->uri); + $edit['files[user_picture_und_0]'] = drupal_realpath($image->uri); $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save')); // As the web user, fill in the comment form and preview the comment. diff --git a/core/modules/comment/templates/comment.tpl.php b/core/modules/comment/templates/comment.tpl.php index 890e457..5a8a37e 100644 --- a/core/modules/comment/templates/comment.tpl.php +++ b/core/modules/comment/templates/comment.tpl.php @@ -20,7 +20,8 @@ * - $permalink: Comment permalink. * - $submitted: Submission information created from $author and $created during * template_preprocess_comment(). - * - $user_picture: The comment author's picture from user-picture.tpl.php. + * - $user_picture: The comment author's picture. Use render($user_picture) to + * print it. * - $signature: Authors signature. * - $status: Comment status. Possible values are: * unpublished, published, or preview. @@ -79,7 +80,7 @@