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.
Problem/Motivation
The localization string for the "Submitted by" node field (NodeSubmittedBy
) is:
Submitted by <a href=":user_link">@user</a> on @date.
This leads to two problems.
First, a user without permissions to view user profiles may be presented with a link that leads to an access denied page.
Second, the user name is already rendered as a link when the current user has access to the user profile, which leads to invalid HTML output like the following:
Submitted by <a href="/users/someone"><a title="View user profile." href="/users/someone" about="/users/someone" typeof="schema:Person" property="schema:name" datatype="" class="username" lang="">Someone</a></a> on Wednesday, June 29, 2016 - 14:01.
Proposed resolution
Remove the link from the text passed to ::t()
.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#16 | ds_submitted-by_2853906_16.patch | 2.29 KB | Jelle_S |
Comments
Comment #2
nedjoComment #4
nedjoTweaking the existing test. Ideally we'd also test with a non-admin user lacking access to user profiles.
Comment #6
nedjoUser profile link is rendered without a span.
Comment #7
wesleydv CreditAttribution: wesleydv at District09 commentedLooks good to me.
Because showing, or not showing, the link is now handled by the user entity rendering I don't think it needs a separate test.
Comment #8
swentel CreditAttribution: swentel as a volunteer commentedcomment shouldn't exceed 80 lines
Comment #9
wesleydv CreditAttribution: wesleydv at District09 commentedPatch #6 does not apply anymore, because the EntitiesTest does not exists anymore
Comment #10
wesleydv CreditAttribution: wesleydv at District09 commentedComment #12
wesleydv CreditAttribution: wesleydv at District09 commentedApparently the test moved to Drupal\Tests\ds\Functional\EntitiesTest updated the patch to change the test there.
Comment #13
Jelle_SRerolled #12.
Comment #14
Jelle_SPrevious reroll was against dev, this one is for 3.2.
Comment #16
Jelle_SRetolled patch #13
Comment #19
swentel CreditAttribution: swentel at eps & kaas for MuseScore commentedcommitted to 8.x-4.x and 8.x-3.x and pushed, thanks!