Skip to content

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 requested review from mikeyarce, natebot and nielslange May 19, 2021 08:07
@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.

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

3 participants