• Hello

    I hope any expierenced user could help me.

    I want to create a importer plugin.
    On activation it needs to check if two other plugins (Newsletter and Membership) are exist and activated. I do this by using is_plugin_activated.

    So I want to avoid activation if any required plugin isn’t installed or activated, because if the plugins are missing or deactivated an import will occur in a fatal error cause I use the api of the plugins.

    If anyone knows how I could archieve that in this case the activation is cancelled and a error message is displayed instead please let me know it.

    I’ve read about trigger_error, but I think there must be a better solution.

Viewing 1 replies (of 1 total)
  • Thread Starter mumbomedia

    (@mumbomedia)

    I think I have figured out it by myself.

    I check the active plugins by using $plugins = get_option('active_plugins');
    Then I check it, if the array contains each necessary plugin.
    If not the function stops with wp_die() so the user got an appropriate message like 'The necessary plugin Pluginname is missing or deactivated<br>Please ensure that this plugin is installed an enabled and then retry to active my_plugin.<br><a href="javascript:history.back(-1); target="_self">Back to plugins page</a>'

    If anyone knows a better solution feel free to post it.

Viewing 1 replies (of 1 total)

The topic ‘Let plugin only activate when conditions true’ is closed to new replies.