Repository navigation
[CONS-505] fix(admin): unnest Sync Roles form so Users settings save - #26
Merged
Merged
Conversation
The "Sync Roles to WorkOS" button rendered its own <form> inside the Settings API options.php form on the Users tab. Nested forms are invalid HTML — the inner </form> closes the outer form early, and because Role Mapping is the last section, the "Save Settings" submit button ends up outside the form. Result: clicking Save did nothing and no Users-tab settings (logout redirects, deprovision action, role map) persisted. Defer the sync form to admin_footer (body level, mirroring the existing Create Organization modal fix) and wire its button back via the HTML5 `form` attribute. The settings form stays intact and saves normally. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bordoni
approved these changes
Jun 9, 2026
…sted-form-save # Conflicts: # CHANGELOG.md
bordoni
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linear: CONS-505 — WorkOS Integration - Admin Settings - Users tab settings do not save
Problem
On WorkOS → Settings → Users, clicking Save Settings did nothing and no changes persisted (logout redirects, deprovision action, reassign user, role map — all silently dropped).
Root cause
The Users tab is wrapped in the WordPress Settings API form:
<form action="options.php" method="post"> settings_fields( 'workos_settings' ); do_settings_sections( 'workos-users' ); // renders all sections submit_button( 'Save Settings' ); // the Save button </form>render_role_map()(the last section) emitted its own<form>for the "Sync Roles to WorkOS" button — nested inside that outer form. Browsers don't allow nested forms: the HTML parser ignores the inner<form>open tag but honors its</form>, which closes the outer settings form early. Because Role Mapping is the last section, thesubmit_button()that follows ends up outside the form, so clicking it submits nothing andoptions.phpnever runs.This is the same class of bug as the earlier "unnest Create Organization modal so settings save works" fix (#6) — that one was missed on the role-sync form. Only the Users tab was affected (the other tabs have no nested form), and only when the plugin is enabled with an org configured (the condition that renders the sync button).
Fix
Mirror the existing modal pattern:
<form>toadmin_footerso it sits at body level, not nested in the settings form (render_role_sync_form()).form="workos-role-sync-form"attribute.The settings form stays intact; Save works. The role-map JS still finds the settings form via
table.closest('form'), so its duplicate-role submit guard keeps working.Testing
admin-post.phpvia the footer form.php -lclean.🤖 Generated with Claude Code