=== Toggle Admin Notices ===
Contributors: umangapps
Tags: admin notices, hide admin notices, manage notices, admin notice manager
Requires at least: 5.0
Tested up to: 7.4
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manages plugin & theme admin notices intelligently — groups by source, supports flexible snooze options, and stores preferences per user.

== Description ==

Toggle Admin Notices cleans up your WordPress dashboard by grouping admin notices according to the plugin or theme that produced them. Each group is collapsible, and every notice can be snoozed for a chosen duration or permanently dismissed — all on a per-user basis.

**Features**

* **Group by source** — notices are organised into collapsible panels labelled with the real plugin/theme display name (read directly from plugin headers).
* **Per-user preferences** — dismissals and snoozes are stored in user meta, so each admin user has independent control.
* **Flexible snooze durations** — choose to snooze a notice for 1 hour, 1 day, or 1 week.
* **Permanent dismiss** — hide a notice for good (for your account).
* **Auto-deduplication** — identical notices shown multiple times are collapsed automatically.
* **Covers all notice hooks** — intercepts both `admin_notices` and `all_admin_notices`.
* **Settings page** — view how many notices are dismissed and reset them with one click (Settings → Admin Notices).
* **PHP 8.4 compatible** — uses typed properties, `str_starts_with()`, and avoids all deprecated patterns.
* **Accessible** — keyboard-navigable group toggles with proper `aria-expanded` attributes and visible focus rings.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`, or install it directly from the WordPress plugin directory.
2. Activate the plugin from the **Plugins** screen.
3. That's it — your admin notices will automatically be grouped.

To reset dismissed notices, go to **Settings → Admin Notices**.

== Frequently Asked Questions ==

= Will this hide critical WordPress core updates? =
No. Critical WordPress core updates and fatal error warnings use dedicated hooks that are not intercepted.

= Does it work with all third-party plugins? =
Yes. The plugin hooks into `admin_notices` and `all_admin_notices`, which are the standard WordPress notice APIs used by nearly all plugins and themes.

= Where are dismissed notices stored? =
Dismissals are stored in user meta (`wp_usermeta`), so they are per-user. Resetting them is available on **Settings → Admin Notices**.

= Does it support multisite? =
It works on individual sites within a multisite network. Network-wide notice management is not yet supported.

= Does this slow down the admin area? =
No. Notice interception uses PHP output buffering (fast), and DOM reorganisation is handled client-side with a small vanilla-jQuery script loaded only in the admin area.

== Changelog ==

= 1.1.0 =
* **New:** Multiple snooze durations — 1 hour, 1 day, or 1 week (previously fixed at 1 day).
* **New:** Settings page under Settings → Admin Notices to view and reset dismissed notices.
* **New:** "Settings" quick-link on the Plugins screen row.
* **New:** Per-user storage via `user_meta` instead of a shared site option, giving each admin independent control.
* **New:** Also intercepts `all_admin_notices` hook (previously only `admin_notices`).
* **New:** Plugin display names are now resolved from actual plugin headers via `get_plugins()`.
* **Improved:** JavaScript refactored — proper `escAttr` helper, keyboard accessibility (`Enter`/`Space` toggles), `aria-expanded` support, and live group-count updates after dismissal.
* **Improved:** CSS updated with accessible focus rings, flexbox action bar, and RTL-friendly spacing.
* **Improved:** PHP 8.4 compatibility — typed class properties, `str_starts_with()`, `ReflectionException` catch, `Closure::fromCallable()` for named-function reflection.
* **Improved:** Groups with a single notice are auto-expanded on load.
* **Fixed:** Empty groups are now removed from the DOM after their last notice is dismissed.

= 1.0.0 =
* Initial release.
* Added functionality to group notices by plugin/theme.
* Added 'Snooze' for 24 hours feature.
* Added permanent 'Dismiss' feature.
* Added auto-deduplication of identical notices.
