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

Chomp whitespace from options #72

Merged
merged 4 commits into from
Nov 26, 2024
Merged

Conversation

snim2
Copy link
Contributor

@snim2 snim2 commented Nov 25, 2024

This PR was prompted by a go-live, where a user had left whitespace in the AwC options form
resulting in analytics not being collected.

Description of changes

  • Fix a typo
  • Provide input validation for options form
  • Trim values in options form before use

Testing

  1. Run a local site
  2. Add this plugin on the main branch
  3. Add values to the options form which contain spaces
  4. Validate that the space appear in the generated HTML of the homepage
  5. Switch to this branch fix/chomp-whitespace-from-options
  6. Refresh the homepage
  7. Check the HTML has not spaces in analytics IDs
  8. Go to http://localhost/wp-admin/options-general.php?page=analytics-with-consent
  9. Add spaces to all text fields
  10. Try to update the options and check that you get validation errors on all text fields

Checklist

  • Changelog updated
  • If new release: major version tag to be bumped after release (see docs)

Sorry, something went wrong.

@snim2 snim2 force-pushed the fix/chomp-whitespace-from-options branch from a6293cb to f35f7af Compare November 25, 2024 20:01

Verified

This commit was signed with the committer’s verified signature.
posva Eduardo San Martin Morote

Verified

This commit was signed with the committer’s verified signature.
posva Eduardo San Martin Morote
If the user enters text which is not chomped, display
a validation error and do not store the input in the
database.

See:
    https://www.advancedcustomfields.com/resources/acf-validate_value/
@snim2 snim2 force-pushed the fix/chomp-whitespace-from-options branch from f35f7af to 36c751e Compare November 25, 2024 20:02
@snim2 snim2 marked this pull request as ready for review November 25, 2024 20:06

Verified

This commit was signed with the committer’s verified signature.
posva Eduardo San Martin Morote

Verified

This commit was signed with the committer’s verified signature.
posva Eduardo San Martin Morote
@snim2 snim2 force-pushed the fix/chomp-whitespace-from-options branch from 36c751e to 5d11519 Compare November 26, 2024 08:47
@snim2 snim2 changed the title Fix/chomp whitespace from options Chomp whitespace from options Nov 26, 2024
Copy link

@matthewpassmore matthewpassmore 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 expected 👍

@snim2 snim2 merged commit 611381a into main Nov 26, 2024
5 checks passed
@snim2 snim2 deleted the fix/chomp-whitespace-from-options branch November 26, 2024 10:34
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.

None yet

2 participants