core/modules/comment/comment.module | 10 +- .../lib/Drupal/comment/CommentRenderController.php | 3 + .../Drupal/comment/CommentStorageController.php | 2 +- .../Drupal/comment/Tests/CommentPreviewTest.php | 3 +- core/modules/comment/templates/comment.tpl.php | 5 +- core/modules/field/field.install | 9 + .../field_sql_storage/field_sql_storage.install | 14 +- .../lib/Drupal/field_ui/Tests/FieldUiTestBase.php | 13 + .../Drupal/field_ui/Tests/ManageDisplayTest.php | 4 +- .../node/lib/Drupal/node/NodeRenderController.php | 4 + core/modules/node/node.module | 9 +- core/modules/node/node.pages.inc | 2 - core/modules/node/templates/node.tpl.php | 4 +- .../Tests/Upgrade/UserPictureUpgradePathTest.php | 57 ++++ core/modules/system/system.admin.inc | 2 +- core/modules/system/system.install | 12 + .../upgrade/drupal-7.user_picture.database.php | 59 ++++ .../user/lib/Drupal/user/AccountFormController.php | 33 -- .../lib/Drupal/user/Plugin/Core/Entity/User.php | 13 +- .../lib/Drupal/user/Plugin/views/field/Picture.php | 131 -------- .../user/lib/Drupal/user/Tests/UserEditTest.php | 8 +- .../user/lib/Drupal/user/Tests/UserPictureTest.php | 352 +++++--------------- .../lib/Drupal/user/Tests/UserRegistrationTest.php | 1 - .../user/lib/Drupal/user/UserStorageController.php | 52 --- core/modules/user/templates/user-profile.tpl.php | 10 +- core/modules/user/user-rtl.css | 6 - core/modules/user/user.admin.inc | 72 ---- core/modules/user/user.api.php | 15 +- core/modules/user/user.css | 23 -- core/modules/user/user.install | 226 ++++++++++++- core/modules/user/user.module | 191 +++-------- core/modules/user/user.views.inc | 19 -- core/profiles/standard/standard.install | 17 +- core/themes/bartik/css/style-rtl.css | 6 +- core/themes/bartik/css/style.css | 11 +- core/themes/bartik/templates/comment.tpl.php | 3 +- core/themes/bartik/templates/node.tpl.php | 4 +- core/update.php | 3 +- 38 files changed, 581 insertions(+), 827 deletions(-) diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index c174293..411ca74 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1560,7 +1560,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'); @@ -1616,7 +1615,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 @@