WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to check if another plugin is active (7 posts)

  1. yonat
    Member
    Posted 4 years ago #

    I want my plugin to show some form elements only if another plugin is active. How can I check that?

    Also, how can my plugin call a function defined in that other plugin?

  2. Mindshare Studios, Inc.
    Member
    Posted 4 years ago #

    This should work for ya:
    http://codex.wordpress.org/Function_Reference/is_plugin_active

    As for calling the function, can't you simply check if then other plugin is active and then call the function normally?

  3. yonat
    Member
    Posted 4 years ago #

    Thanks!

    As for calling the function - my bad. I actually need to call it from javascript, which means I probably need to find an appropriate httprequest.

  4. ballinascreen
    Member
    Posted 4 years ago #

    I guess you could always write a plugin of your own that accepts an appropriate HTTP request, checks if the required plugin is active and returns a response. However, if your plugin is responsible for generating the form contents, then I can't see why your plugin can't check if the appropriate plugin(s) are active, before generating the form content in the first place - is it likely that a plugin could be enabled/disabled during the time that someone is viewing the form - and would potentially invalidate it?

  5. yonat
    Member
    Posted 4 years ago #

    Thanks. Eventually I found a nice hook where I can call the function, so all is well. :-)

  6. mac97000
    Member
    Posted 3 years ago #

    Hi ;)

    I'm sorry but the response when I use this function is :

    Fatal error: Call to undefined function is_plugin_active()

    Do you know if this function exist with wp 3.0.1 ?

    I've not found anithyng about an other function.

  7. WebTechGlobal
    Member
    Posted 3 years ago #

    Works for me...

    if (is_plugin_active('wp-cart-for-digital-products/wp_cart_for_digital_products.php'))

    doing an update on my Easy CSV Importer to allow importing to the eStore plugin. Only want user to have the options and forms if the plugin is installed.

    If anyone has not clicked, this is a perfect way to keep the interface tidy and not show a lot of things a user won't ever use.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags