Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I have a CHAT plugin for wordpress

    Is it one here (link please)? Much of the functionality of plugins is added via add_action or add_filter. Using conditional in your functions.php file could let you remove that chat code if the person is not the correct user role.

    Thread Starter Lucas

    (@criatweb)

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I was really wishing that you’d have a plugin that is in the WordPress repository here. Your best option would be to contact the plugin author and ask him.

    http://codecanyon.net/user/geosith

    We don’t have access to commercial plugin software like that (don’t want access either). Once you figure out how that’s added then you can write another plugin or edit your theme’s functions.php file so that it’s removed from the add_action or add_filter and re-added after checking the user role.

    Thread Starter Lucas

    (@criatweb)

    Hmm, but let’s suppose that’s the code:

    add_action( ‘init’,’oc_init’,1);

    How would I adapt it to my needs? :3

    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' );
    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    That’s along the lines I was going to suggest. Keep at it you’re doing fine. 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Execute plugin if EDITOR is online’ is closed to new replies.