Closed swissspidy closed 6 years ago
When the site option doesn't exist yet you get the update message twice, same as in https://github.com/wearerequired/WP-Widget-Disable/issues/11.
Should set_default_options()
set the default site option if is_multisite()
? Since that's only called by register_activation_hook()
what about plugin updates?
Yeah, we could totally extend set_default_options()
and perhaps always call it on init
. However, I'm not a huge fan of just adding an empty options anyway.
I'd much rather like to investigate why this happens.
For instance, we call settings_errors( 'wp-widget-disable' );
on admin_notices
. That should be called on multisite as well, so there's no need to call settings_errors()
in views/admin.php
for multisite
In save_network_options()
I used general
instead of wp-widget-disable
, which is also incorrect:
tl;dr:
settings_errors()
call from viewget_settings_errors()
and add_settings_error()
set_default_options()
@swissspidy Changed a few things but did you see my mention of #11 and #18 which is basically https://core.trac.wordpress.org/ticket/21989?
Yes, and I replied to that. Couldn‘t we solve this by first checking if there are some errors before adding one in the sanitize callback?
admin_footer_text()
and print_admin_styles()
are currently ignored on the network admin screen because $screen->base
has -network
as a suffix which add_submenu_page()
does not add. For print_admin_styles()
see #34, do we still want admin_footer_text()
?
Even though we could just add the suffix for that case, I don‘t think there‘s much value in it really.
With this patch, the network admin looks like this:
To do:
add_settings_error()
doesn't work because there's a redirect happening. We could add a GET parameter in that case, .e.g.&updated=<count>
.Fixes #29.