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

feat: automatically disable guest authors #3345

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

leogermani
Copy link
Contributor

@leogermani leogermani commented Aug 15, 2024

All Submissions:

Changes proposed in this Pull Request:

After the introduction of the Guest Contributor role, we now want to be more proactive and disable CAP's guest authors if the site is not using the feature yet.

CAP's Guest Authors feature will be disabled by default if there are no Guest Authors in the site. If you want to force enabling it, add the NEWSPACK_ENABLE_CAP_GUEST_AUTHORS constant to your wp-config.php file.

How to test the changes in this Pull Request:

  1. In a site that has some Guest Authors
  2. Enable this branch and confirm the feature is still enabled and working
  3. Check that the option was set: wp option get newspack_check_site_has_cap_guest_authors should return yes
  4. Delete all your guest authors (or start with a new site)
  5. Make sure to delete the option: wp option delete newspack_check_site_has_cap_guest_authors
  6. Load any page of the site again
  7. Confirm Guest Authors are disabled and you see our replacement page instead
  8. Confirm the option now has the value no
  9. Add define( 'NEWSPACK_ENABLE_CAP_GUEST_AUTHORS', true ); to wp-config
  10. Confirm CAP's Guest Authors are re-enabled

Testing CRON

  1. Repeat steps 1 to 4
  2. Run wp cron event run newspack_re_check_guest_authors
  3. Confirm Guest Authors are disabled and you see our replacement page instead
  4. Confirm the option now has the value no

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@leogermani leogermani added the [Status] Needs Review The issue or pull request needs to be reviewed label Aug 15, 2024
@leogermani leogermani self-assigned this Aug 15, 2024
@leogermani leogermani requested a review from a team as a code owner August 15, 2024 21:44
Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

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

Works as described, but I wonder if the migration won't be too involving.

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Aug 16, 2024
@leogermani leogermani added Work In Progress and removed [Status] Approved The pull request has been reviewed and is ready to merge labels Sep 20, 2024
@leogermani leogermani added [Status] Needs Review The issue or pull request needs to be reviewed and removed Work In Progress labels Oct 22, 2024
@@ -78,6 +83,13 @@ public static function initialize() {

// Hide author email on the frontend, if it's a placeholder email.
\add_filter( 'theme_mod_show_author_email', [ __CLASS__, 'should_display_author_email' ] );

// Make sure we check again if the site has guest authors evey hour.
Copy link
Member

Choose a reason for hiding this comment

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

typo

Suggested change
// Make sure we check again if the site has guest authors evey hour.
// Make sure we check again if the site has guest authors every hour.

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants