Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#7094 closed enhancement (invalid)

Filter to allow insertion of messages onto the post edit form

Reported by: simonwheatley's profile simonwheatley Owned by: westi's profile westi
Milestone: Priority: normal
Severity: normal Version:
Component: Administration Keywords: needs-patch
Focuses: Cc:


Currently it's not easily possible to insert a message onto the edit form; for example a plugin might check a post on publication, determine it's unsuitable in some way and need to return the user to their post with a message explaining what's happened.

The attached patch adds a filter hook to allow plugin authors to manipulate the message being displayed on edit_form_advanced.php. Example plugin code shown below:

// Fictional example, for simplicity...
// This function triggered by a $_GET param. The $_GET
// param is added if the profanity filter detects rudeness.
function em_filter_display_message( $display_message )
	// Should we display a message?
	$em_message = (bool) @ $_GET['em_message'];
	if ( ! $em_message ) return $display_message;
	// OK. Let's display one...
	return 'Hello. This is WordPress speaking... less profanity in your posts, please.';

// Our message
add_filter( 'edit_form_advanced_message', 'em_filter_display_message' );

Attachments (1)

edit_form_msg_filter.patch (835 bytes) - added by simonwheatley 16 years ago.
Patch adding filter to manipulate user message edit_form_advanced.php

Download all attachments as: .zip

Change History (5)

16 years ago

Patch adding filter to manipulate user message edit_form_advanced.php

#1 @simonwheatley
16 years ago

  • Keywords has-patch needs-testing 2nd-opinion added

#2 @westi
16 years ago

  • Keywords needs-patch added; has-patch needs-testing 2nd-opinion removed
  • Milestone changed from 2.7 to 2.8
  • Owner changed from anonymous to westi
  • Status changed from new to assigned

I think an action would be better here to allow a plugin to just output some html instead.

Move to 2.8 for now as we are feature frozen

#3 @janeforshort
15 years ago

  • Milestone changed from 2.8 to Future Release

Punting due to feature freeze. Reconsider with next release.

#4 @Denis-de-Bernardy
15 years ago

  • Component changed from General to Administration
  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from assigned to closed

see admin_notices

Note: See TracTickets for help on using tickets.