Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.0-rc1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
17 Aug 2011 at 20:47 UTC
Updated:
18 Sep 2012 at 12:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
Crell commentedAnd patch.
In order to call format_username() we need to have a uid, so this patch now forces them to be loaded. I also opted, at Dave Reid's suggestion, to make it configurable in case someone really wants the unformatted name. The default is to use the formatted name as I think that's the more common use case, and what people would expect coming from Drupal 6. I won't be offended if the maintainers want to change that before committing, however. :-)
This patch was rolled against the RC1 release, but I'm assuming it's small enough that it should still apply to -dev. If not, bah. Let me know and I'll try to reroll.
Comment #2
Crell commentedAnd of course that && really ought to be a ||. *sigh*
Comment #3
bojanz commentedThe idea makes sense, I'm just worried about:
We've had bad experience with passing fake entities to core functions. We might want to ensure we're passing the full user account here.
We're already doing it in some other places, since #1172970: provide a unified way to retrieve result entities landed.
Comment #4
dawehnerSadly the patch is already commited, forgot to update the issue.
Comment #5
Crell commentedUm, OK, so I guess this is now a follow-up / clean up issue? Retitling...
I am wary about loading the full user object, on the grounds that it is still at least one IO hit, even if it's better cached now in D7. That's why I didn't do so originally. If the maintainers want to go that route, though, that's their call.
Comment #6
bojanz commentedWe can always ignore it until someone complains (works for a lot of things :P).
The existing code works for core, it's just the module's that implement hook_username_alter() who are going to be surprised.
Comment #7
Crell commentedThey already are, since core passes nodes and comments to format_username() already. (No joke. It's really pathetic how unstandardized that is.) The only guarantee is the presence of a uid and name property, and since nodes, comments, and users all have that, core gleefully passes all of those at various times.
Comment #8
bojanz commentedReality is so fun.
And for anyone stumbling on this through search, here's a clarification:
Comment #10
JvE commentedThis caused bug #1609088: Undefined index: uid in views_handler_field->get_value() (line 375 of views_handler_field.inc).