[wp-trac] [WordPress Trac] #20833: Settings API notices/errors can get lost by checking for errors for a specific setting

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 18 19:57:26 UTC 2012


#20833: Settings API notices/errors can get lost by checking for errors for a
specific setting
------------------------------------+------------------------------
 Reporter:  kobenland               |       Owner:
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Administration          |     Version:  2.9
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------------------

Comment (by obenland):

 1. Settings error is saved by the Settings API in the `'settings_error'`
 transient.
 2. On next page-load (redirected back to the original settings page)
 `settings_errors()` gets called, looking for errors to a specific setting.
 3. Since `$_GET['settings-updated'` is set, the transient gets pulled into
 the temporary variable `$settings_errors` and then deleted (all other
 errors, previously added by `add_settings_error()`, also get merged into
 the `$settings_errors` variable)
 4. Errors to a specific setting are requested, so `$settings_errors` get
 looped through, unsetting every error that does not belong to the
 requested setting. Including the ones from the transient.

 Patch merges the errors into the global `$wp_settings_errors` variable,
 making them available through multiple calls to `settings_errors()`.

 Patch also returns only the requested errors, without unsetting all
 others.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20833#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list