[wp-trac] [WordPress Trac] #9991: Wrap plugin notices in a function

WordPress Trac wp-trac at lists.automattic.com
Wed Aug 19 23:03:50 UTC 2009


#9991: Wrap plugin notices in a function
----------------------------+-----------------------------------------------
 Reporter:  scribu          |       Owner:  westi                        
     Type:  enhancement     |      Status:  reviewing                    
 Priority:  normal          |   Milestone:  2.9                          
Component:  Administration  |     Version:  2.7                          
 Severity:  normal          |    Keywords:  has-patch tested dev-feedback
----------------------------+-----------------------------------------------
Changes (by scribu):

 * cc: scribu@… (added)
  * keywords:  has-patch tested reporter-feedback => has-patch tested dev-
               feedback


Comment:

 Replying to [comment:5 westi]:
 > Can you explain in more detail what you are trying to achieve with this.
 >
 > I am not sure I see the point in making this change.

 The usage I have in mind:

 On activation, X plugin does a compatibility check.

 It doesn't like something and it deactivates itself.

 Then, it adds an action to admin_notices:


 {{{
 add_action('admin_notices', 'x_plugin_error', 9);

 function x_plugin_error() {
   remove_action('admin_notices', 'plugin_notices');

   echo "<div class='error'><p>This plugin is not compatible</p></div>";
 }
 }}}

 Without this patch, there would be two messages: one that says "Plugin not
 compatible" and one that says "Plugin activated".

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9991#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list