• Resolved petedan

    (@petedan)


    I have the Wishlist showing in the menu, but I would like for the Wishlist not to show for a certain user role only.

    Do you have a hook to disable the Wishlist menu?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author templateinvaders

    (@templateinvaders)

    Hi @petedan

    We added ‘tinvwl_add_to_menu’ filter to allow disable wishlist products counter from a 3rd party code in the latest plugin update. You can check a sample snippet here:

    https://gist.github.com/doozy/6f8271036d0090dd18458a54b71531ce

    Thread Starter petedan

    (@petedan)

    Thank you for this. I actually took a different route, I disabled the plugin for a user role. For anyone interested, just change the “user-role-here” in the code below:

    add_action( 'disable_plugins_user_role', 'disable_plugins' );
    function disable_plugins() {
    $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); // Get active plugins
    $plugin = 'ti-woocommerce-wishlist/ti-woocommerce-wishlist.php'; // TI Woocommerce Wishlist plugin
    
    	if ( in_array( $plugin, $active_plugins ) ) { // Check if plugin is active
    		if( current_user_can( 'user-role-here' ) ) { // Check user role
    			deactivate_plugins( $plugin ); // Deactivate plugin
    		}
    	}
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove From Menu For User Role’ is closed to new replies.