pluginkollektiv / statify

Statify – statistics plugin for WordPress
https://wordpress.org/plugins/statify/
GNU General Public License v3.0
76 stars 22 forks source link

preserve NULL for "show_widget_roles" option, if unset #274

Closed stklcode closed 10 months ago

stklcode commented 10 months ago

Steps to reproduce

  1. Install Statify on a fresh site or update from 1.x to 2.0 (no show_widget_roles option set).
  2. Click on "Configuration" (reduced settings tab) on the dashboard widget
  3. Save options (no changes needed)

Observed (mis)behavior

Widget is gone, i.e. nobody can see it.

We set a default 'show_widget_roles' => array() unconditionally. Empty array is equivalent to "no roles checked", so nobody can see anything.

Solution

Preserve null or unset options and only sanitize, if actually set.

sonarcloud[bot] commented 10 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication