I made #994148: Extract common functionality from user reference and node reference? a bit worse and added the code for full user rendering when they are displayed in an entity that has that reference. It is ofcourse 90% the same code as with nodes. The only change that could matter is the lacking user_view_multiple, so that is bypassed in a custom loop.

I also added a $langcode for user and node as well in the node_view_multiple and user_view loop.
The patch will be included in next comment.

Comments

Stalski’s picture

StatusFileSize
new8.35 KB

This patch works with latest 7.2 from cvs.

swentel’s picture

Subscribe comment - great patch and good functionality!

johnv’s picture

subscribe. Tested and satisfied!
I would like new view modes, but I suppose I must google for 'custom "view mode" drupal 7' .
Thanks!

johnv’s picture

Status: Needs review » Reviewed & tested by the community
johnv’s picture

One can easily create a custom view mode for nodes as described here: http://drupal7theme.com/content/drupal-7-custom-node-view-modes .
It's worth trying if patch can support different view modes for users.

Stalski’s picture

bumping this to get attention :)

kunago’s picture

Very good patch and also a needed one. Please, do commit this.

johnalbin’s picture

User reference fields are a nightmare without this, IMO.

I'm using this patch with the Entity view mode module (which allows me to create arbitrary user view modes) and it all works great!

presleyd’s picture

Works great for me.

johnv’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new8.11 KB
new8.13 KB

The patch #1 is outdated. Updated version is attached. (actually, 2. the smaller one is with unix-style CR/FL.)

Status: Needs review » Needs work

The last submitted patch, references-1051624-10_user_view_mode.patch, failed testing.

idflood’s picture

I should have searched the issue queue before doing it myself... But the good thing is that I came up with the same modifications as in patch #10. Well, 80% of them since I didn't implement everything. I'm not sure about the modification in node_reference/node_reference.module. This may be better to do it in another issue but I may be wrong.

johnv’s picture

I'm not sure about the modification in node_reference/node_reference.module.

I had the same doubt.
@Stalski, can you remember this patch from 9 months ago and shinesome light?

idflood’s picture

Status: Needs work » Needs review
StatusFileSize
new661 bytes
new7.55 KB

Here is a reroll of the patch in #10, hope I didn't forget anything. I've splitted the patch in 2, the small one beeing only for the modification in node_reference/node_reference.module.

I've tested it locally and it looks like it's working even without the second patch.

yched’s picture

Status: Needs review » Fixed
StatusFileSize
new6.48 KB

Rerolled after #1085576: path or URL as display output, and committed the attached patch.
Thanks !

Note: I did not include the changes in node_references.module (those indicated in patch #10 n°2), and I also adjusted the corresponding code added in user_reference.module.

I'm not 100% positive, but I don't think this is a valid change. You want the entity rendered in the same language that is currently rendering the page.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.