Make WordPress Core

Opened 9 years ago

Closed 5 years ago

Last modified 5 years ago

#32096 closed defect (bug) (fixed)

Twenty Fifteen: author-bio.php clashes with "bio" username

Reported by: lordlod's profile lordlod Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch dev-feedback bulk-reopened
Focuses: Cc:

Description

The TwentyFifteen theme uses the file author-bio.php as a partial to display author information.

However this clashes with the template hierarchy magic author-$nicename.php

This problem manifests by creating a user with the username "bio"
Then accessing their author page ?author=$id
Instead of the expected author page the raw partial is shown.

I believe a fix requires renaming author-bio.php possibly to partial-author_bio.php
References in content.php and content-link.php also would need to be updated.

Attachments (5)

32096.diff (531 bytes) - added by rclations 9 years ago.
32096.2.diff (1.0 KB) - added by rclations 9 years ago.
32096.3.diff (2.0 KB) - added by rclations 9 years ago.
32096.4.diff (2.0 KB) - added by ianbelanger 6 years ago.
Updated patch to apply to current trunk, updated @since and added another conditional check for author post number
32096.5.diff (2.0 KB) - added by ianbelanger 5 years ago.
Refresh of 32096.4.diff and fixes typo in Twenty Thirteen functions.php

Download all attachments as: .zip

Change History (28)

#1 @SergeyBiryukov
9 years ago

  • Component changed from Themes to Bundled Theme
  • Summary changed from TwentyFifteen author-bio.php clashes with author bio to Twenty Fifteen: author-bio.php clashes with author bio

#2 @SergeyBiryukov
9 years ago

  • Summary changed from Twenty Fifteen: author-bio.php clashes with author bio to Twenty Fifteen: author-bio.php clashes with "bio" username

#3 @lancewillett
9 years ago

  • Keywords 2nd-opinion close added

Thank you for the report, lordlod. My opinion is this is an edge case and probably won't happen very often. Instead the author could adjust their theme (or use a child theme) to change the references and avoid the issue.

Other opinions very welcome.

#4 @obenland
9 years ago

  • Keywords needs-patch added; 2nd-opinion close removed

Nice find @lordlod!

We can't rename the file for back compat concerns, but we can add a check if it's an archive and handle that case accordingly.

@rclations
9 years ago

#5 @rclations
9 years ago

@obenland, were you thinking something along the lines of this?

#6 @obenland
9 years ago

It should probably be handled in the template itself since it only applies to Twenty Fifteen.

@rclations
9 years ago

#7 @rclations
9 years ago

Good call. I checked all the default themes and found the issue in Twenty Thirteen as well.
32096.2.diff attempts to deal with this in the theme - thoughts?

#8 @SergeyBiryukov
9 years ago

I think this logic should be implemented via template_include filter in the theme's functions.php file.

@rclations
9 years ago

#9 @rclations
9 years ago

Thanks for the feedback!
Tried the filter method with 32096.3.diff

used @since Twenty Fifteen 1.2 & @since Twenty Thirteen 1.6 (assuming these would be next versions of the themes?)

#10 @rclations
9 years ago

  • Keywords has-patch added; needs-patch removed

#11 @obenland
9 years ago

  • Version changed from trunk to 4.0

#12 @karmatosed
9 years ago

  • Keywords needs-testing added

#13 @karmatosed
9 years ago

  • Milestone changed from Awaiting Review to Future Release

#14 @karmatosed
8 years ago

  • Keywords dev-feedback added; needs-testing removed

This feels like a lot of code for something so edge case. I'd be keen to review this and consider if we do think it's worth doing and if that is the case, if we can find a less impactful way.

@ianbelanger
6 years ago

Updated patch to apply to current trunk, updated @since and added another conditional check for author post number

#17 @ianbelanger
6 years ago

  • Keywords bulk-reopened added
  • Version changed from 4.0 to trunk

IMO, this issue breaks a page which is available for anyone to view and can be crawled by the SE bots. So even though it might be an "edge" case, it is still something that should be fixed. I'm not sure that I agree that the current fix is that impactful either. It only effects template loading for this particular issue. Also, I'm not sure that there is a better way to handle it.

All that being said, I tested the most recent patch and it failed to apply, so I updated the patch against trunk. While doing so, I noticed another issue with the previous fix. If the author named bio did not have any published posts, then the previous fix did not work, so I updated the patch to check against the authors post number.

32096.4.diff addresses all of these things:

  • Refreshed patch against current trunk
  • Better targeted function names to their particular theme
  • Updated @since for both themes
  • Added conditional check for authors published post number

I understand that there are differing opinions on whether this should be fixed, so if there are any objections to fixing this, please state your case. Otherwise, in the interest of closing out old tickets, I will recommend that this be committed into the bundled themes.

#18 @ianbelanger
6 years ago

  • Version trunk deleted

#19 @ianbelanger
5 years ago

  • Keywords needs-refresh added

@ianbelanger
5 years ago

Refresh of 32096.4.diff and fixes typo in Twenty Thirteen functions.php

#20 @ianbelanger
5 years ago

  • Keywords needs-refresh removed
  • Milestone set to Future Release

@laurelfulford and @davidakennedy would love to get your opinion on this ticket. It may be an edge case, but IMHO since it does break a template that is publicly visible on any site using either TwentyThirteen or TwentyFifteen, then it should probably be fixed. I also don't see any backcompat issues with fixing this. Thoughts?

Going to mark for Future Release as it was marked this way before the bulk closing of stale tickets.

#21 @ianbelanger
5 years ago

  • Milestone changed from Future Release to 5.3

Moving into 5.3 milestone for consideration, pending dev-feedback

#22 @SergeyBiryukov
5 years ago

In 45718:

Twenty Fifteen: Prevent author-bio.php partial template from interfering with rendering an author archive of a user with the bio username.

Props rclations, ianbelanger, lordlod, SergeyBiryukov.
See #32096.

#23 @SergeyBiryukov
5 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 45719:

Twenty Thirteen: Prevent author-bio.php partial template from interfering with rendering an author archive of a user with the bio username.

Props rclations, ianbelanger, lordlod, SergeyBiryukov.
Fixes #32096.

#24 @SergeyBiryukov
5 years ago

In 45720:

Twenty Fifteen: Make twentyfifteen_author_bio_template() use author templates if exist, fall back to regular template hierarchy otherwise.

See #32096.

#25 @SergeyBiryukov
5 years ago

In 45721:

Twenty Thirteen: Make twentythirteen_author_bio_template() use author templates if exist, fall back to regular template hierarchy otherwise.

See #32096.

Note: See TracTickets for help on using tickets.