[buddypress-trac] [BuddyPress Trac] #6747: Notice: Undefined index: max_groups
buddypress-trac
noreply at wordpress.org
Mon Nov 23 17:55:37 UTC 2015
#6747: Notice: Undefined index: max_groups
--------------------------------+------------------
Reporter: slaFFik | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.5
Component: Component - Groups | Version:
Severity: normal | Resolution:
Keywords: has-patch |
--------------------------------+------------------
Comment (by boonebgorges):
I've done some research here (my first time figuring out how the
Customizer works with widgets). It looks like the "problem" is this. When
adding a widget via widgets.php, an AJAX request is performed that
involves serializing the widget control form (`$widget->form()`) as part
of the POST payload, and then running it through `$widget->update()` on
the server. So `WP_Widget` classes can safely assume that, by the time
`widget()` is first run (ie, the markup is generated), the `form()`
elements will have been processed at least once. This is a ''de facto''
technique for enforcing a widget's "default options".
When adding widgets via the Customizer, the `form` -> `update()` routine
is not run. (It *does* run when saving widget options in the Customizer,
after the widget has been added.) It seems to me that this is a bug, or at
least a shortcoming, of the Customizer's Widgets implementation, which is
in part due to some serious shortcomings of the WP Widgets API. I've
brought it up with the Customizer team to get their thoughts.
In the meantime, I think we (and all WP plugin authors!) need to be aware
that the method responsible for generating widget markup, `widget()`, must
be self-sufficient. That is, it should be able to be called without
expecting anything to be in the database. Something
[attachment:6747.patch] is a cheap way of doing it. We might also consider
sweeping through our widget classes and defining some defaults in a more
standardized way - maybe in a `default_args()` method - which can be used
both in `form()` and in `widget()`.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6747#comment:5>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list