Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
May 8, 2023

Conversation

ggutenberg
Copy link
Contributor

@ggutenberg ggutenberg commented Mar 20, 2023

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
Copy link
Collaborator

@peterwilsoncc peterwilsoncc left a comment

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.

includes/utils.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@peterwilsoncc peterwilsoncc left a comment

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