[wp-trac] [WordPress Trac] #11308: Handling plugin dependencies

WordPress Trac wp-trac at lists.automattic.com
Sat May 8 07:21:24 UTC 2010


#11308: Handling plugin dependencies
-------------------------+--------------------------------------------------
 Reporter:  apeatling    |        Owner:  westi     
     Type:  enhancement  |       Status:  closed    
 Priority:  normal       |    Milestone:            
Component:  Plugins      |      Version:            
 Severity:  normal       |   Resolution:  worksforme
 Keywords:  plugins      |  
-------------------------+--------------------------------------------------

Comment(by johnjamesjacoby):

 As it sits today, we have plugin authors add this little bit in their
 code:
 {{{
 if ( defined( 'BP_VERSION' ) )
         your_plugin_prefix_init();
 else
         add_action( 'bp_init', 'your_plugin_prefix_init' );
 }}}
 ...and then wrapping pretty much the entire plugin inside that
 your_plugin_prefix_init() call.

 There's two problems:
 1.) Not every plugin author does this.
 2.) If a plugin called "AAA BuddyPress" loads before BuddyPress does,
 without the above code, it expects for BP functions to be available and
 white screens the entire install.

 I get that this is a developer education issue, but this is also something
 that other plugins could eventually use not unlike how jQuery plugins need
 to make sure jQuery is loaded first.

 It would be nice if there was some core WP way for plugins to register
 themselves as ready and available in a reliable way. I went the css/script
 route because in many ways plugins are extensions of the WP core much like
 CSS and JS are extensions to HTML markup.

 The benefit of plugin dependencies would allow for plugins to "light up"
 with special features when other plugins are installed.

 At the very least, it would be nice if there was a dedicated WP function
 to check if a plugin is active and completely loaded without error,
 without doing file_exists checks and site_option checks.

 Maybe plugins could "register" themselves with WP into an array at the end
 of their load cycle? It would be an optional function for plugins that
 want to tell WP "hey, I'm here, I'm ready, and I'm friendly!" so that
 other plugins can call:
 {{{
 if ( !is_plugin_loaded( 'plugin_name' ) ) return false;
 }}}

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


More information about the wp-trac mailing list