Problem/Motivation
template_preprocess_node() and template_preprocess_comment both call user_view($author, 'compact'); but the compact entity display settings are defined in standard.profile and hence may not exist.
In best case scenario, extra fields are rendered (these are rendered by default for a non-existent display mode).
In worst case scenario, you end up with recursion (#2114887: Maximum nesting level when attaching comment field to User.)
Proposed resolution
Node module comes with a new user view mode (node_author) and configured display mode
Comment modules comes with a new user view mode (comment_author) and configured display mode
Standard profile comes with overrides of the configured display modes and include image field settings for user pictures (comment and node cannot know if image module is enabled in their config).
Upgrade path.
Remaining tasks
Everything
User interface changes
None
API changes
None
Data model changes
New view mode and entity display config objects.

| Comment | File | Size | Author |
|---|---|---|---|
| #37 | user_compact_view_mode-1972242-37.patch | 404 bytes | vprocessor |
| #22 | user_compact_view_mode-1972242-22.patch | 1.04 KB | andriyun |
Comments
Comment #1
chx commentedComment #2
amateescu commentedHow about this instead?
Comment #3
amateescu commented...
Comment #4
amateescu commentedThe effect is basically the same, we disable the output of 'user_picture'. @tim.plunkett asked me why did I remove the $default_theme assignment.. because it wasn't used :/
Comment #5
amateescu commentedAdded a comment for the 'compact' view mode.
Comment #6
chx commentedPurr-fect.
Comment #7
alexpottCommitted 3e88fc4 and pushed to 8.x. Thanks!
Comment #8
chx commentedSame for comment. Either revert the patch above and apply mine or roll one for comment as well.
Comment #9
szantog commentedDisable member for field in compact view of user in minimal profile should be an ultimate solution?
Comment #10
amateescu commentedNo.. chx was right from the start. I tried to find an alternative way because the patch in #1 included the uuid property but I could've just removed it. Sorry chx :)
Comment #12
amateescu commentedThat's what you get when you mess with the updgrade path :/
Comment #15
larowlanBlocks #2114887: Maximum nesting level when attaching comment field to User.
Comment #16
alexpottDiscussed with @catch today - he was a fan of a new module that both node and comment could depend on. However we have more problems since we have to prevent user.compact from being deleted too. It should be locked. And we need to be sure that it can't be deleted. This is one of the causes of #2114887: Maximum nesting level when attaching comment field to User.
Comment #18
larowlanFixed issue summary
Comment #19
andypostmaybe we need to allow calculated fields to be exposed through formatters?
that used in comments too
Comment #20
andypostIs it possible to add new view modes for user at this stage?
Looks that makes UX worth, and does not prevents to add displaying comment field on them
Comment #21
andypostComment #22
andriyun commentedJust rerolled #22 patch
Comment #23
andriyun commentedtrigger testbot
Comment #24
andriyun commentedComment #25
andypostThis needs hook_update for existing installs
Comment #26
andriyun commentedComment #34
larowlanIssue summary approach isn't consistent with current patch - can someone confirm preferred approach?
Comment #36
vprocessor commentedComment #37
vprocessor commentedJust rerolled #22 patch
And removed changes in '/core/profiles/minimal/minimal.install' because we have this configs in profile with the same changes
Comment #47
quietone commentedI'm following up on issues that have been committed and re-opened.
This issue was committed to Drupal 8.x in April 2013 and re-opened in #8 to make the same changes to comments. The last discussions were in 2015. More information was asked for in 2015 in #15 and so far, none has been provided.
Is there anything still to do here? If so, update the Issue Summary and add a comment.
Thanks
Comment #48
joachim commentedtemplate_preprocess_node() and template_preprocess_comment() now have a guard on getting the 'compact' user view, so I think we can say this got fixed: