Problem/Motivation
Usernames printed by node_feed() can't be altered by other modules. In 7.x this is due to the omission of format_username().
Proposed resolution
8.x is being patched as part of #421586: Author nevertheless displayed in RSS feeds if disabled for privacy reasons.
Use format_username() in 7.x.
Remaining tasks
Make the changes mentioned in #7 to the 7.x patch in #3.
Original report by @versvs
Hi,
before starting, thanks for building this module that does only one thing but does it pretty well :)
Now, my question. Maybe it is me but I dont find how to make the Real Name to display in feed items. While it shows properly whenever the user is invoked, it fails to replace the user name when the nodes are showed as part of any RSS.
Any ideas? Maybe it is something that can be achieved by tinkering with the options, I just didn't find it. I also find it surprising that searching for "feed" or "rss" didn't help. As I think that I'm asking for something that's not that strange, It appears to me that the answer is probably too obvious for anyone to ask. So if this is the case, sorry for the inconvenience. Any help will be appreciated.
Comment | File | Size | Author |
---|---|---|---|
#19 | drupal7-Issue-1640404-15-by-hass-RSS-Use-formatusername-for-use.patch | 762 bytes | dcam |
#15 | Interdiff-1640404-9-15.txt | 1.06 KB | er.pushpinderrana |
Comments
Comment #1
versvs CreditAttribution: versvs commentedI found this thread on views, but this is definetily related issue. I'm finding my problem in the main drupal feed (drupalsite/rss.xml), which (as far as I believe) i did not replace with a view...
http://drupal.org/node/1460506
Comment #2
hass CreditAttribution: hass commentedMoving to core.
node_feed()
is not usingformat_username()
inarray('key' => 'dc:creator', 'value' => $node->name),
what prevents realname module for changing the username to a real name.Comment #3
hass CreditAttribution: hass commentedThis patch should do the trick, but has not been tested.
Comment #5
Lostboy22 CreditAttribution: Lostboy22 commentedWorks well with 7.27 and 7.28
I don't change node.module to ajax system, unless retesting did that.
Comment #6
hass CreditAttribution: hass commentedComment #7
dcam CreditAttribution: dcam commentedEdit: 8.x is being patched in another issue.
I may be wrong, but I think 8.x has the same issue. Here is the same line in 8.x:array('key' => 'dc:creator', 'value' => $node->getOwner()->label()),
I checked the User entity class and found that getUsername() is what allows other modules to alter the usernames for display like format_username() does in 7.x. There's an issue just like this for comment_preview(), but someone posted that 8.x's comment_preview() was already fixed. I checked it and it does use getUsername(). So, I think 8.x node_feed() probably needs to be changed, but someone should verify that.As for the 7.x patch, we have the user ID in $node->uid.
Let's use user_load($node->uid) here instead of user_load_by_name(). I don't know which would be the faster query, but user_load_by_name() calls user_load_multiple() with its $conditions argument which is deprecated. It's probably a moot point given that 8.x is mostly built and so different, but I'd still rather use user_load().
Comment #8
dcam CreditAttribution: dcam commentedI should have searched for duplicate issues before posting all that. See #421586-21: Author nevertheless displayed in RSS feeds if disabled for privacy reasons where it was decided not to combine the two issues. 8.x is being fixed there, so I'm bringing this one back to 7.x.
Comment #9
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedIn this patch, use
user_load($node->uid)
here instead ofuser_load_by_name()
. Please review updated patch.Comment #11
dcam CreditAttribution: dcam commentedSorry, I guess I wasn't clear. I meant user_load_by_name() should be replaced by user_load() on this line that is being added by the patch.
Comment #12
amit.drupal CreditAttribution: amit.drupal commentedUse function user_load_by_name($node->name); for load user.
Please review patch.
Comment #13
er.pushpinderrana CreditAttribution: er.pushpinderrana commented@amit.drupal, first of all thanks for updating the patch.
@dcam, thankyou so much for correcting me. You were clear but I missed your point, sorry for that (-:.
Thanks again!
Comment #14
hass CreditAttribution: hass commentedThe correct base patch is #3
Comment #15
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedohh.... @hass thankyou, I also dint review @amit.drupal patch due to lack of interdiff file. I think as I understood, we just need to change the following line, please review updated patch.
Comment #16
dcam CreditAttribution: dcam commentedThat's better. Once #15 comes back green I'll RTBC it.
Comment #18
dcam CreditAttribution: dcam commentedI have no idea what went on with the file hiding. I think all this cross-posting is freaking out the comment form. I'm going to set this back to Needs Review so hopefully Testbot will pick #15 back up.
Comment #19
dcam CreditAttribution: dcam commentedRe-uploading #15 due to wierdness with the comment form that caused it to be hidden/deleted. I am not the author of this patch and it should not be attributed to me.
Comment #20
dcam CreditAttribution: dcam commented#15 (re-uploaded in #19) is RTBC.
Comment #23
dcam CreditAttribution: dcam commentedComment #26
dcam CreditAttribution: dcam commentedComment #28
hass CreditAttribution: hass commentedComment #32
hass CreditAttribution: hass commentedComment #36
dcam CreditAttribution: dcam commentedComment #37
David_Rothstein CreditAttribution: David_Rothstein commentedAs far as I can see, there is no such bug in Drupal 8 (and the issue linked to above is fixing something else)...
Therefore, committed to 7.x - thanks!