admin管理员组

文章数量:1305642

I wrote a code to allow in-store product managers, without post editing permissions, and without other product editing permissions. I have a number of issues with the code, I would love to resolve.

  1. There are three menus in the control panel, which are not used and they appear anyway (the main page of the dashboard, Marketing, Woocommerce ).
  2. I need to allow the product author to receive emails.

I want to fix the code and not install plugins.

add_role('vendor_shop', __(
   'vendor_shop'),
   array(
       'read'            => true, // Allows a user to read
       )
);

    
    $result = add_role(
'vendor_shop',
    __( 'vendor_shop' ),
array(

$role = get_role( 'vendor_shop' ),
$role->add_cap( 'manage_woocommerce' ),
$role->add_cap( 'delete_private_products' ),
$role->remove_cap( 'edit_others_products' ),
$role->remove_cap( 'edit_dashboard' ),
$role->remove_cap( 'fluentform_dashboard_access' ),
$role->add_cap( 'delete_product' ),
$role->add_cap( 'delete_product_terms' ),
$role->add_cap( 'delete_products' ),
$role->add_cap( 'delete_published_products' ),
$role->add_cap( 'edit_private_products' ),
$role->add_cap( 'edit_product' ),
$role->add_cap( 'edit_product_terms' ),
$role->add_cap( 'edit_products' ),
$role->add_cap( 'publish_products' ),
$role->add_cap( 'read_private_products' ),
$role->remove_cap( 'wysija_stats_dashboard' ),
$role->add_cap( 'manage_product_terms' ),
$role->add_cap( 'edit_published_products' ),
$role->add_cap( 'manage_product_terms' ),
$role->add_cap( 'manage_product_terms' ),
$role->add_cap( 'read_product' ),
$role->add_cap( 'views_products' ),

     
 
    
$role->remove_cap( 'edit_posts' ),
$role->remove_cap( 'view_woocommerce_reports' ),
$role->add_cap( 'manage_woocommerce_products' ),
$role->remove_cap( 'manage_woocommerce_orders' ),
$role->remove_cap( 'edit_shop_order' ),
$role->remove_cap( 'view_shop_order' ),
$role->add_cap( 'assign_product_terms' ),
$role->remove_cap( 'edit_pages' ),
$role->remove_cap( 'import' ),
$role->add_cap( 'views_upload' ),
$role->add_cap( 'unfiltered_upload' ),
$role->remove_cap( 'edit_others_shop_order' ),
$role->remove_cap( 'edit_others_posts' ),
$role->remove_cap( 'publish_posts' ),
$role->remove_cap( 'publish_shop_order' ),
$role->remove_cap( 'edit_published_posts' ),
$role->remove_cap( 'edit_others_posts' ),
$role->remove_cap( 'edit_others_posts' ),
$role->remove_cap( 'delete_others_products' ),
$role->remove_cap( 'edit_published_pages' ),
$role->remove_cap( 'delete_published_pages' ),
$role->remove_cap( 'delete_published_posts' ),
$role->remove_cap( 'edit_woocommerce_coupons' ),
$role->remove_cap( 'manage_shop_order' ),
$role->remove_cap( 'edit_shop_coupons' ),
$role->remove_cap( 'export' ),
)
);

本文标签: woocommerce offtopicProblems adding instore product managers