Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I can't find a way to display the realname in the user profile in a view mode. This would be an extra field.
Patch following.
Comment | File | Size | Author |
---|---|---|---|
#29 | realname-2333459-interdiff-10-29.txt | 649 bytes | rudiedirkx |
#29 | realname-2333459-29.patch | 1.31 KB | rudiedirkx |
Comments
Comment #1
rudiedirkx CreditAttribution: rudiedirkx commentedVoila patch. Very easy.
Comment #2
rudiedirkx CreditAttribution: rudiedirkx commentedNow with a link to the user profile, if the current user has access to that.
Comment #4
rudiedirkx CreditAttribution: rudiedirkx commentedNote to self: don't hack patches.
Attached patch is re-rolled against 1.2.
Comment #8
rudiedirkx CreditAttribution: rudiedirkx commentedFFS! Last attempt!
Comment #10
rudiedirkx CreditAttribution: rudiedirkx commentedThis patch is unsafe. Use #29.
Now it's getting ridiculous....
Comment #11
rudiedirkx CreditAttribution: rudiedirkx commentedComment #12
hass CreditAttribution: hass commentedHave you tried views field module or how was this named...?
Comment #13
rudiedirkx CreditAttribution: rudiedirkx commentedViews field? How is that related to an extra field in the user profile?
Comment #14
hass CreditAttribution: hass commentedIt allows you to show what you are looking for. I'm using this to show views data.
Comment #15
rudiedirkx CreditAttribution: rudiedirkx commentedWho's talking about views??
"Extra fields" doesn't mean "more fields". It means extra_fields.
Comment #16
hass CreditAttribution: hass commentedIt allows you to add a field to every entity and the source of the vield is a view. And this view can select the realname. See https://www.drupal.org/project/viewfield
Comment #17
rudiedirkx CreditAttribution: rudiedirkx commentedAre you seriously talking about adding a real field to load a real view, to display a logicless name? This is THE reason extra_fields exist.... You don't create a field and a view to display a node title or created date, do you?
Did you see the patch? That's what an
extra_field
does. No logic, no display settings, no querying, just a simple display.Comment #18
hass CreditAttribution: hass commentedI know what extra fields are. The views solution may be a bit heavy. However I wonder that you do not have the first/lastname in user fields. I'm using addressfield and it shows perfectly.
Comment #19
rudiedirkx CreditAttribution: rudiedirkx commentedI have 3 fields that combined are the realname. Sometimes 1 of those 3 fields is shown. I can do that with the normal field display. Other times the full name (realname) is displayed. No addressfield. Realname takes care of the combination logic/pattern. Now I need to display it...
It seems a sensible addition. Whether to add it, is up to you.
Comment #20
Michael_Lessard_micles.biz CreditAttribution: Michael_Lessard_micles.biz commentedFeedback : this seems like a good place to quickly mention how not user-friendly the D7 version of this module has become.
D6 was more user friendly; albeit somewhat complicated: it was easy to understand how to make the real name field appear.
D7 Realname needs some clear HowTo instructions ("If needed, create a text field in Account Settings > Manage Fields. In the Real name settings, browser tokens options and use your desired field instead of core User name").
Comment #21
ericclaeren CreditAttribution: ericclaeren commentedGreat, thanks for the patch. Will this land in a stable release soon?
Comment #22
rudiedirkx CreditAttribution: rudiedirkx commented@dreamlabs If you've reviewed & tested, change the issue status so the maintainer knows this one's ready to go.
Comment #23
ericclaeren CreditAttribution: ericclaeren commentedIt works for me, simple fix. Could the maintainer look at this?
Comment #24
ericclaeren CreditAttribution: ericclaeren commentedComment #25
ericclaeren CreditAttribution: ericclaeren commentedComment #26
simon_j_nichols CreditAttribution: simon_j_nichols commentedI haven't deployed this, but looking at the code, doesn't the #markup create a URL to the user account page, while being displayed on the user account page.
Not a problem as such .....
:)
Nice code though, I didn't know about the hook_field_exta_fields function
Comment #27
hass CreditAttribution: hass commentedIsn't there a checkplain required on the realname if I have no view permissions?
Comment #28
rudiedirkx CreditAttribution: rudiedirkx commentedVery true!
#10 is unsafe.
Comment #29
rudiedirkx CreditAttribution: rudiedirkx commentedNew patch & interdiff.
#entity_type
was also missing from the fake field.Comment #30
rudiedirkx CreditAttribution: rudiedirkx commentedRealname strips HTML tags during its update process:
(which is WRONG IMO), so #10 isn't really unsafe, but wrong nonetheless.
Comment #31
hass CreditAttribution: hass commentedJust reviewed this patch and wondered why I cannot select how to label should be shown. This should work like all other fields.
Comment #32
hass CreditAttribution: hass commentedDamn, we cannot make this invisible by default.
Comment #34
hass CreditAttribution: hass commentedComment #36
rudiedirkx CreditAttribution: rudiedirkx commentedExtra fields don't have settings out of the box. They're still very useful to position fields, like in this case. I have a Sandbox I use to add settings to extra fields. https://www.drupal.org/sandbox/rudiedirkx/2501347 I don't think D8 will have this out of the box.
Comment #37
hass CreditAttribution: hass commentedI have read that this is already in D8, but haven't verified it myself.
Comment #38
rudiedirkx CreditAttribution: rudiedirkx commentedExtra fields with settings?? That would be awesome, but
hook_entity_extra_field_info()
doesn't mention anything. Neither doesEntityFieldManagerInterface::getExtraFields()
.Comment #39
hass CreditAttribution: hass commentedNo, just the default setting for visibility can be configured. This is what I'd wish to do here. Hide it by default.
Comment #40
rudiedirkx CreditAttribution: rudiedirkx commentedAh yes. It's still TRUE by default in D8, which is still weird, but it's better.
You can explicitly check the display settings for the extra field. If it's not explicitly enabled, it's not user-enabled. A lot of code to check something very simple...
This is what I use in Node Registration, including the comment =)
Comment #41
hass CreditAttribution: hass commentedSee #1256368: Add 'visible' key to hook_field_extra_fields()