Opened 5 years ago
Last modified 3 months ago
#53338 new enhancement
Determine when there is an error submitting the wp-signup.php form
| Reported by: | henry.wright | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Networks and Sites | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: | multisite |
Description
For both the wp-signup.php user and blog forms there doesn't seem to be a way to determine if an error occurred in the form submission aside from error text being displayed above the form.
If a body class of something like error is added or something like error=true is appended to the query string then developers will be able to perform actions or style the page easier.
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I think marking the form itself is the cleanest option here.
Form level marker (preferred): The
<form id="setupform">elements render insidesignup_user(),signup_blog()andsignup_another_blog(), after thevalidate_*functions have determinedhas_errors(). So the state is known there, and we can add a class and/or data attribute directly, e.g.class="wp-signup-error"ordata-has-error="true", ideally via a filter. Server side, works without JS, comes back with thePOSTresult, no restructuring. A hidden field likename="error"I would avoid, since it gets resubmitted on the nextPOST.Body class:
body.wp-signup-errorhas wider reach, but<body>is output byget_header()before the error is known. It would require buffering the form processing ahead of the header, which changes the order of some actions (preprocess_signup_form, the network admin notice) relative towp_headand risks breaking plugins. Only worth it if that reach is really needed.Query string: I would drop
error=true. It needs a Post/Redirect/Get flow that loses the entered values unless persisted first. Too large for this.Question: Does a form level class plus data attribute cover the use cases, or is a page wide body class needed?