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

Fix: Give each attribute in Edit Flow settings page a different id #650

Merged
merged 1 commit into from
May 20, 2021

Conversation

htdat
Copy link
Member

@htdat htdat commented May 19, 2021

Fix #631


Description

This PR is pretty simple. It's simply to use slug of each module and append it to the current name/id.

Steps to Test

  1. Apply this PR.
  2. Visit wp-admin/admin.php?page=ef-settings
  3. No longer see Found 8 elements with non-unique id #change-module-nonce error in your browser console.
  4. See this page's HTML source, search change-module-nonce, there will be 8 results with a different suffix.

@htdat htdat self-assigned this May 20, 2021
Copy link
Contributor

@natebot natebot left a comment

Choose a reason for hiding this comment

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

Left a note asking about the nonce validation.

@@ -269,7 +269,7 @@ function print_modules() {
if ( $mod_data->options->enabled == 'off' ) echo ' style="display:none;"';
echo ' value="' . __( 'Disable', 'edit-flow' ) . '" />';
echo '</p>';
wp_nonce_field( 'change-edit-flow-module-nonce', 'change-module-nonce', false );
wp_nonce_field( 'change-edit-flow-module-nonce', 'change-module-nonce-' . $mod_data->slug, false );
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this name change mean for validating the nonce?

Copy link
Contributor

Choose a reason for hiding this comment

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

nm, I see the nonce doesn't change based on name.

Copy link
Member Author

Choose a reason for hiding this comment

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

nm, I see the nonce doesn't change based on name.

Yeah, that's right. The change-edit-flow-module-nonce action for wp_nonce_field and wp_verify_nonce is still the same.

@htdat htdat merged commit a60b823 into master May 20, 2021
@htdat htdat deleted the fix/631 branch May 20, 2021 03:27
@htdat
Copy link
Member Author

htdat commented May 20, 2021

Thanks @natebot :D

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.

Error: Found 8 elements with non-unique id #change-module-nonce
2 participants