[wp-trac] [WordPress Trac] #7094: Filter to allow insertion of messages onto the post edit form

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 4 21:58:45 GMT 2008


#7094: Filter to allow insertion of messages onto the post edit form
---------------------------+------------------------------------------------
 Reporter:  simonwheatley  |       Owner:  anonymous
     Type:  enhancement    |      Status:  new      
 Priority:  normal         |   Milestone:  2.7      
Component:  General        |     Version:           
 Severity:  normal         |    Keywords:           
---------------------------+------------------------------------------------
 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' );


 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7094>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list