Introduction
WordPress is currently lacking a fundamental mechanism: sending notifications to users to give them feedback about state changes in the system. Traditionally, plugin developers and Core have been using admin notices for this purpose, but this solution is lackluster at best and comes with a lot of disadvantages:
- They are rendered into the normal working area in the dashboard and can even push the actual page content below the fold.
- The user has no control over how or when they want to deal with them, therefore they see them in a mostly negative fashion.
- They are nothing more than printed HTML. Because they lack any kind of structure, it is not possible to manipulate them in an automated fashion.
- Their persistence is not regulated, which leads to many different implementations as well as cruft in the database.
For the above reasons, there's a general consensus that admin notice are not up to the task and need a more robust replacement that can deal with current and future notification needs.
I hereby want to officially kickstart a Feature Project called "WP Notify".
Project Scope
The initial project will cover an extensible backend implementation as well as a single frontend use case.
A. Backend implementation
The backend implementation will cover the following elements:
- An object model that is extensible as well as serializable (to JSON).
- A persistence abstraction that comes with an initial WPDB implementation.
- A background queue that processes notifications to distribute them across channels, for use cases where this is a costly operation, like sending them through email.
- A simplified procedural API that allows for easy manipulations the way plugin developers are accustomed to.
- REST API controllers that provide endpoints to manage the notification from the frontend.
B. Frontend use case
The frontend use case will cover the following elements:
- An admin bar integration that shows notification state and opens a panel to read and dismiss current notifications.