• Mình ?ang s? d?ng plugin KiotVietSync ?? ??ng b? v?i website woocommerce c?a mình, tuy nhiên hi?n t?i ch? có Admin user m?i có th? truy c?p ???c menu c?a Kiot. Mình th? hook trong file function.php thì menu ?? hi?n trong b?ng ?i?u khi?n c?a Shop Manager user, tuy nhiên khi mình nh?n vào m?t menu b?t k? c?a Kiot thì b? l?i “R?t ti?c, b?n kh?ng th? truy c?p trang này”.

    if (is_admin()) {  
        add_action('admin_menu', 'add_plugin_for_shop_manager');  
    }
      
    function add_plugin_for_shop_manager() {  
        if (!current_user_can('manage_options')) {  
        	add_menu_page('KiotViet Sync',
                'KiotViet Sync',
                'manage_woocommerce',
                'plugin-kiotviet-sync',
                array('display_plugin_setup_page'),
                '',
                '10');
    		add_submenu_page('plugin-kiotviet-sync', 'Thi?t l?p th?ng tin ??ng b?', 'Thi?t l?p th?ng tin ??ng b?', 'manage_woocommerce', 'plugin-kiotviet-sync', array('action_kiotvietsync_config'));
            add_submenu_page('plugin-kiotviet-sync', 'Danh sách s?n ph?m ??ng b?', 'Danh sách s?n ph?m ??ng b?', 'manage_woocommerce', 'plugin-kiotviet-sync-product', array('action_kiotvietsync_product'));
            add_submenu_page('plugin-kiotviet-sync', 'Danh sách ??n ??t hàng', 'Danh sách ??n ??t hàng', 'manage_woocommerce', 'plugin-kiotviet-sync-order', array('action_kiotvietsync_order'));
            add_submenu_page('plugin-kiotviet-sync', 'L?ch s? ??ng b?', 'L?ch s? ??ng b?', 'manage_woocommerce', 'plugin-kiotviet-sync-history', array('action_kiotvietsync_history'));
        }
    }

    Hy v?ng Kiot có th? h? tr? mình cách ?? cho phép Shop Manager qu?n ly ???c KiotVietSync, và n?u có th? tích h?p ???c tính n?ng này cho l?n update sau thì càng tuy?t v?i ? (ví d? tính n?ng ch?n nh?ng user roles nào có th? qu?n ly ???c plugin).
    Mình c?m ?n.

  • The topic ‘Allow Shop Manager to access plugin’ is closed to new replies.