The user picture is provided by a field called user_picture.

If you perform a minimal installation of Drupal 8, this field is not created, so you have no user pictures what so ever. The "User pictures in posts" and "User pictures in comments" options in the theme settings are disabled as well.

If you create a new image field, there is no way to make this field the "user pricture" field. And due to the special naming of the "user_picture" field (instead of eg "field_user_picture") there seems to be no way to achieve this through the interface.

CommentFileSizeAuthor
#6 hard-coded-user-picture-2668736.patch11.7 KBdpi

Comments

tterranigma created an issue. See original summary.

swentel’s picture

Hmm, yeah, we should make it persistent field, just like the body field is so you can re-use it easily.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dpi’s picture

Version: 8.3.x-dev » 8.4.x-dev
Assigned: Unassigned » dpi
Status: Active » Needs review
StatusFileSize
new11.7 KB

We cannot rely on the user picture being available in Drupal 8, the comment_user_picture/node_user_picture theme toggles actually refer to whether the author user entity's compact view mode is rendered.

I propose changing references to user picture to the view mode. This primarily consists of translation string changes and adding theme variable replacing the existing picture variables.

Before I add tests I want to make sure validate this is the correct course of action.

Patch

There is no behaviour change here, references to user pictures already use compact view mode.

  • Changed usage of user_view() to use view builder directly.
  • Added deprecation notice to user_picture_enabled()
  • Added new author_view template variable to node.twig.html and comment.twig.html
  • Theme setting form refers to compact view directly, instead of pictures.
  • Fixed usage of global t() in theme setting form. Use translation trait instead.
  • Amended author_picture (node.twig.html) and user_picture (comment.html.twig) template variable descriptions to refer to the new compact view variable.
  • todo?: The system.theme.global:comment_user_picture,node_user_picture configs need to be marked as needing name change for D9..?
swentel’s picture

+++ b/core/themes/stable/templates/content/comment.html.twig
@@ -74,7 +75,7 @@
+    {{ author_view }}

I don't think we can make this change from a BC point of view. If people upgrade, they suddenly will get different output which is not what we want to happen.

- edit - scratch that, nothing changes effectively ..

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

borisson_’s picture

I don't think we can change anything in the stable theme, so I don't think we can do this. If we do, we should use proper deprecation for user_picture_enabled.

borisson_’s picture

Status: Needs review » Needs work
Issue tags: +@deprecated

Setting to needs work to add the deprecation.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

So is this just about marking user_picture_enabled as depreciated?

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)

per #17

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Wonder if this is still a need feature request?

paintingguy’s picture

Yes.

After upgrading from D9 to 10 user_picture was renamed to field_user_picture . I cannot fix this or create a new field without appending field to the machine name.

Any help on fixing this would be greatly appeciated

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Needs work
dpi’s picture

Assigned: dpi » Unassigned
geekinformatic’s picture

This is expected behavior in Drupal 10 and not something that can be “fixed” by renaming or recreating the field.

In Drupal 8+ (including Drupal 9 and 10), user pictures are implemented using the Field API, and all configurable fields are required to use the field_ prefix. Because of this, user_picture can no longer exist as a configurable field, and core correctly provides field_user_picture instead. Drupal core does not allow creating or renaming configurable fields without the field_ prefix.

If you are encountering breakages after upgrading, the solution is to update any custom code, templates, Views, or configuration that still reference user_picture and change those references to field_user_picture.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.