[wp-hackers] Plugin dependency checking

Austin Matzko if.website at gmail.com
Sat Jun 13 00:53:07 GMT 2009

On Fri, Jun 12, 2009 at 7:29 PM, Burt Adsit<burt at ourcommoninterest.org> wrote:
> Austin Matzko wrote:
>> If it's a matter of wanting the child plugins to be able to redefine
>> the pluggable function, you could let the parent plugin define the
>> pluggable function as a wrapper of a parent plugin's factory method,
>> which would then open up the possibility of child plugins re-defining
>> the behavior of the pluggable function.
> Haha. (Sorry). I've been trying to keep up with this thread and have been
> doing fairly well up to this point. Austin, could you put this last bit a
> little less concisely?

Let's say you want either a parent plugin or one of its children to be
able to redefine the behavior of a pluggable function, such as

Then in the parent plugin, you could have something like the following:

class ParentPluggableAuthenticate {
   function __construct($username, $password)
      // some logic to determine which child plugin's method should be
used to replace wp_authenticate()'s functionality
      // call that child method

function wp_authenticate($username, $password) {
   return new ParentPluggableAuthenticate($username, $password);

Or something like that.

More information about the wp-hackers mailing list