You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both issues have been addressed in branch fix/391-dashboard-widget-visibility-and-db-errors:
Widget visible when disabled for all roles
The root cause was twofold: HTML multi-select elements don't submit a value when nothing is selected, and the widget code treated "nothing submitted" the same as "never configured" — both fell back to showing the widget for administrators.
Fixes:
Added a new "Dashboard Widget" enable/disable toggle (widget_enabled) that provides an unambiguous on/off control, separate from the role-based visibility setting.
Fixed the settings save handler to explicitly store an empty array when no roles are selected in the multi-select, so the code can distinguish "never configured" from "explicitly disabled for all."
Extracted the duplicated visibility logic into a single has_widget_access() method.
Added a zerospam_dashboard_widget_visible filter so developers can override visibility programmatically.
2. Database errors (Table 'prefix_zerospam_log' doesn't exist)
The widget now checks for table existence before running queries. When the log table is missing, it shows a clean notice with a link to the settings page instead of triggering raw SQL errors.
Additional improvements in this fix:
Widget transient cache clears immediately when settings are saved (no more 5-minute delay).
Refresh button now updates stats and charts in-place via AJAX (no page reload).
Chart.js is bundled locally instead of loaded from CDN.
AJAX refresh correctly returns network-level data on multisite network admin dashboards.
Activity
EusebiuOprinoiu commentedon Jan 28, 2026
In addition, when the widget is displayed, it generates multiple database errors:
Table 'dbname.prefix_zerospam_log' doesn't existThe correct table name is
prefix_wpzerospam_log, notprefix_zerospam_log.fix(dashboard-widget): resolve widget visible when disabled and DB er…
bmarshall511 commentedon Mar 16, 2026
Both issues have been addressed in branch fix/391-dashboard-widget-visibility-and-db-errors:
The root cause was twofold: HTML multi-select elements don't submit a value when nothing is selected, and the widget code treated "nothing submitted" the same as "never configured" — both fell back to showing the widget for administrators.
Fixes:
Added a new "Dashboard Widget" enable/disable toggle (widget_enabled) that provides an unambiguous on/off control, separate from the role-based visibility setting.
Fixed the settings save handler to explicitly store an empty array when no roles are selected in the multi-select, so the code can distinguish "never configured" from "explicitly disabled for all."
Extracted the duplicated visibility logic into a single has_widget_access() method.
Added a zerospam_dashboard_widget_visible filter so developers can override visibility programmatically.
2. Database errors (Table 'prefix_zerospam_log' doesn't exist)
The widget now checks for table existence before running queries. When the log table is missing, it shows a clean notice with a link to the settings page instead of triggering raw SQL errors.
Additional improvements in this fix:
Widget transient cache clears immediately when settings are saved (no more 5-minute delay).
Refresh button now updates stats and charts in-place via AJAX (no page reload).
Chart.js is bundled locally instead of loaded from CDN.
AJAX refresh correctly returns network-level data on multisite network admin dashboards.
fix(#391): dashboard widget visible when disabled & DB errors
Merge pull request #400 from Highfivery/fix/391-dashboard-widget-visi…