• Resolved Lucas

    (@criatweb)


    I use a comercial chat plugin, and I would like to make some changes on it:

    My goal is to activate it only when there’s an admin online, but the purpose of this topic is:

    How do I find the add_filter/add_action that enables the plugin?

    Is there a way to find it in the Editor, by the name of the plugin or something like that?

    When i find it, I’ll try to make something like:

    if admin is online {
    add_filter (plugin)
    else
    remove_filter (plugin)
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Lucas

    (@criatweb)

    Ok, I’m almost done with it!!

    function deactivate_plugin_conditional() {
        if ( is_plugin_active('online-chat/online-chat.php') ) {
        deactivate_plugins('online-chat/online-chat.php');
        }
    }
    add_action( 'admin_init', 'deactivate_plugin_conditional' );

    I just need a “if” condition for editor online!! If userid 1 is online, or something like that!

    Thread Starter Lucas

    (@criatweb)

    I think I MADE IT!!!

    function deactivate_plugin_conditional() {
    if (!is_user_logged_in()) {
        if ( is_plugin_active('online-chat/online-chat.php') ) {
        deactivate_plugins('online-chat/online-chat.php');
        }
    	}
    if (is_user_logged_in()) {
    	activate_plugins('online-chat/online-chat.php');
    	}
    }
    add_action( 'admin_init', 'deactivate_plugin_conditional' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to find out the line that calls a plugin? add_filter, add_action?’ is closed to new replies.