Admin needs standardized way of handling messages (notices) displayed to the user
|Reported by:||filosofo||Owned by:|
If you try to upload a media item under Media > Add new without an uploads directory, you get the following vague error message:
Error saving media attachment.
If you try instead to upload from the post edit page, you get a much more helpful message:
Unable to create directory /path/wp-content/uploads. Is its parent directory writable by the server?
In each case, the root error is the same, but the second error message points the way to a solution. Even if the user doesn't know herself what that message means, it's a message that provides the necessary information to someone else who does and is trying to help the user. The first message is completely useless, as it states only what we already know: something went wrong.
The reason Media > Add new doesn't offer a helpful message is that the error is generated on one page request, and then the user is redirected to another page.
We need a standard, cross-page-load way of conveying messages in admin.
I've thought of a few possible ways of doing this:
- Define and use a standardized set of error codes and associated error messages. This is similar to what happens currently on many pages: the unhelpful "Error saving media attachment." appears when the message argument is set to "3." What I'm suggesting would use a common set of message codes across the admin and be much more detailed. So the above situation would instead produce a message like "Unable to create the uploads directory."
- Save error messages to a cookie. Unlike the previous method, this would allow messages to be made particular to their event.
- Have some kind of user messaging stack. New messages would be pushed into a user's stack (stored in usermeta) and popped off after a certain time, or when read, etc. This has the advantage of lasting across sessions and browsers and being usable for other applications, such as PMs between users.
What do you think?
Change History (27)
7 years ago
- Cc ptahdunbar added
- Summary changed from Admin needs standardized way of handling error messages to Admin needs standardized way of handling messages (notices) displayed to the user