• Resolved kaprikorn

    (@kaprikorn)


    Hi, I need to deactivate Terawallet for a specific user role. I use the following snippet code which works perfectly for any other plugin installed on my website.

    add_action(‘admin_init’, ‘desactivate_plugin_wallet’);
    function desactivate_plugin_wallet()
    {
    global $current_user;
    if (in_array(‘specific_role’, $current_user->roles)) {
    deactivate_plugins( ‘/woo-wallet/woo-wallet.php’ );
    } else {
    activate_plugins( ‘/ woo-wallet/woo-wallet.php’ );
    }
    }

    However for Terawallet it does not! Why? Please help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    Try below updated code and let me know.

    add_action('admin_init', 'desactivate_plugin_wallet');
    function desactivate_plugin_wallet()
    {
        global $current_user;
        if (in_array('specific_role', $current_user->roles)) {
            deactivate_plugins( WOO_WALLET_PLUGIN_FILE );
        } else {
            activate_plugins( WOO_WALLET_PLUGIN_FILE );
        }
    }

    Hi, I’m trying to disable the plugin for the wholesale_customer role. I tried the above with no success.

    Same issue. Can someone please post solution. TerraWallet allows to add UserRoles to be excluded but they still gain points and show up in the Woocommerce users account, so for example excluded wholesale customers still see earned points but aren’t allowed to use them. Need to hide from the accounts.

    Plugin Author Subrata Mal

    (@subratamal)

    Use init hook instead admin_init

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Desactivate Terawallet for a specific user role’ is closed to new replies.