[wp-trac] [WordPress Trac] #6636: Multi-widget data loss
WordPress Trac
wp-trac at lists.automattic.com
Mon Apr 7 21:15:51 GMT 2008
#6636: Multi-widget data loss
----------------------+-----------------------------------------------------
Reporter: mdawaffe | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.5.1
Component: General | Version: 2.5
Severity: major | Keywords:
----------------------+-----------------------------------------------------
1. Add a text widget to your sidebar. Give it a title and some text.
2. Click "Save Changes".
3. After the page reload, click "Edit" on that text widget.
4. Click "Cancel" on that text widget.
5. Click "Save Changes".
6. Your text widget has just been emptied of all data.
The same thing happens with our other multi-widgets.
#6291 [7411] caused this regression.
The way widget canceling works, is that the JS disables all the form
fields. The widget control callback sees that there is no $_POST data for
that widget and skips it. The above change, however, guarantees that
there will always be $_POST data for each widget and so "canceled" widgets
are not skipped, and so "canceled" widgets are filled with empty data.
The means by which we detect widget canceling is not great; it can be much
improved.
The attached, though, corrects the problem with the least code change:
before updating the widget, the control function makes a more explicit
check to make sure there is the $_POST data for that widget. If not, it
will be skipped unless it is a brand new widget (user adds *new* text
widget, user clicks "Edit", user clicks "Cancel" user clicks "Save
Changes), in which case an empty widget is added.
--
Ticket URL: <http://trac.wordpress.org/ticket/6636>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list