Skip to content

Check if the post is distributed, and if it is apply the author filter#1035

Merged
peterwilsoncc merged 7 commits into
developfrom
fix/author-override-author-block
May 8, 2023
Merged

Check if the post is distributed, and if it is apply the author filter#1035
peterwilsoncc merged 7 commits into
developfrom
fix/author-override-author-block

Conversation

@ggutenberg

@ggutenberg ggutenberg commented Mar 20, 2023

Copy link
Copy Markdown
Contributor

Description of the Change

If an author ID is specified in a call to get_the_author_meta(), instead of returning the specified author blindly, we are also checking the post itself and whether or not it was distributed. If it was, we apply the get_the_author_display_name and get_the_author_user_url filters as usual.

Closes #1015

How to test the Change

Make sure you're using a theme that supports the block editor for this like Twenty Twenty-Two, as the Classic editor themes don't have an issue.

  1. Create a post on the source site.
  2. Distribute it to the target site.
  3. In Distributor settings, make sure that Override Author Byline is checked.
  4. View the distributed post on your site. Note that it displays the source site as the author.
  5. Uncheck Override Author Byline in the Distributor settings.
  6. View the distributed post on your site. Note that it now displays the target site's author.

Changelog Entry

Fixed - Author override fails in the block theme author block.

Credits

Props @ggutenberg

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@ggutenberg ggutenberg changed the title Check if the post is distributed, and if it is return the original site Check if the post is distributed, and if it is return the original site as author Mar 20, 2023
@ggutenberg ggutenberg changed the title Check if the post is distributed, and if it is return the original site as author Check if the post is distributed, and if it is apply the author filter Mar 21, 2023
@ggutenberg ggutenberg marked this pull request as ready for review March 21, 2023 15:20
@ggutenberg ggutenberg requested a review from a team as a code owner March 21, 2023 15:20
@ggutenberg ggutenberg requested review from dkotter and peterwilsoncc and removed request for a team March 21, 2023 15:20
@jeffpaul jeffpaul added this to the 2.0.0 milestone Mar 21, 2023

@peterwilsoncc peterwilsoncc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests well, thanks Garth.

I've made one suggestion inline.

Comment thread includes/utils.php Outdated
Comment thread includes/utils.php

@peterwilsoncc peterwilsoncc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT, checked on a variety of block and classic themes.

@peterwilsoncc peterwilsoncc merged commit 083d076 into develop May 8, 2023
@peterwilsoncc peterwilsoncc deleted the fix/author-override-author-block branch May 8, 2023 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Author override fails in the block theme author block.

3 participants