WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 months ago

#9818 closed feature request (maybelater)

add a wp_notification functionality to output notices and errors on the front end

Reported by: Denis-de-Bernardy Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Themes Keywords: needs-patch
Focuses: template Cc:

Description

On occasion, a plugin needs to return some kind of feedback. It would be nice if a standard hook existed for this.

It could go something like this:

add_filter(wp_notification, foobar)

foobar() appends to an array of notification messages that get displayed to the user on the front end.

then, on page load:

  • in wp_head if notifications is not empty, we add a style, wp_notification, that makes elements of this class invisible, and we load jQuery
  • if do_action(wp_notification) is explicitly called on the page, we display the messages in there, without the class, and disable the notification on the wp_footer hook
  • an action gets fired on wp_footer if do_action(wp_notification) is not called, and we use ajax to place the needed messages in a absolutely positioned div element, with a close button.

we could also add some kind of do_action(wp_commentform_notification), nearby the comments form, to output comment-related errors in their "correct" location as well.

Change History (7)

comment:1 Denis-de-Bernardy5 years ago

  • Summary changed from a wp_notification field to add a wp_notification functionality to output notices and errors on the front end

comment:3 Denis-de-Bernardy5 years ago

  • Milestone changed from Future Release to 2.9
  • Owner set to Denis-de-Bernardy
  • Status changed from new to accepted

comment:4 Denis-de-Bernardy5 years ago

  • Owner Denis-de-Bernardy deleted
  • Status changed from accepted to assigned

comment:5 westi4 years ago

  • Component changed from UI to Template
  • Milestone changed from 2.9 to Future Release

Moving to the Template Component as this is asking for a new template tag and related functionality.

Moving to Future Release as there is no patch.

comment:6 F J Kaiser4 years ago

  • Cc 24-7@… added

comment:7 nacin3 months ago

  • Component changed from Template to Themes
  • Focuses template added
  • Milestone Future Release deleted
  • Resolution set to maybelater
  • Status changed from assigned to closed

This is an interesting thought but as this never went anywhere, I'm closing this. I wouldn't be surprised if it gets revived later, of course. But this is no small paradigm shift.

Note: See TracTickets for help on using tickets.