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

Header Images: fix cropping for users without the 'customize' capability #854

Merged
merged 9 commits into from
Sep 19, 2024

Conversation

mattwiebe
Copy link
Contributor

@mattwiebe mattwiebe commented Aug 13, 2024

I think I found a Core bug here. There's absolutely no reason for the ajax request to include wp_customize=on, the logic is entirely handled in the wp_ajax_crop_image() handler.

This commit appears to have moved the logic from the Customizer into a more general purpose context while leaving the constraining wp_customize=on parameter.

I guess this could be a core patch

Fixes #846

Proposed changes:

Make a custom controller but without wp_customize=on

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  1. Be logged in as an author-level user (or any other user who can create posts but not edit others' posts)
  2. Ensure that this user is ActivityPub-enabled
  3. Go to profile and attempt to upload and crop an image. Any image uploaded or chosen from the library should work (the library will now only show the author user's own posts)

@mattwiebe
Copy link
Contributor Author

I fixed the remaining problem in 3000bf5 - you can't crop an image that you didn't upload when you can't edit others' posts, failing this check that supplies the nonces.

This is definitely ready for testing again @pfefferle

Copy link
Member

@pfefferle pfefferle left a comment

Choose a reason for hiding this comment

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

works like a charm!

@pfefferle pfefferle merged commit 1136dd3 into master Sep 19, 2024
22 checks passed
@pfefferle pfefferle deleted the fix/author-header-uploads.php branch September 19, 2024 10:02
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.

Can't add Header Image to authors - cropping fails
2 participants