Refactor admin cl interface and handle product access with groups
This commit is contained in:
@@ -4,7 +4,31 @@ class Wiaas_Product {
|
||||
|
||||
public static function init() {
|
||||
require_once dirname( __FILE__ ) . '/product/class-wiaas-product-category.php';
|
||||
require_once dirname( __FILE__ ) . '/product/class-wiaas-product-supplier.php';
|
||||
require_once dirname( __FILE__ ) . '/product/class-wiaas-product-supplier.php';
|
||||
|
||||
add_filter('woocommerce_register_post_type_product', array(__CLASS__, 'define_product_capabilities'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define capabilities for editing products so we can easily control read/edit/create access for them
|
||||
*
|
||||
* @param $args
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function define_product_capabilities($args) {
|
||||
|
||||
$args['capabilities'] = array(
|
||||
'edit_post' => 'edit_product',
|
||||
'read_post' => 'read_product',
|
||||
'delete_post' => 'delete_product',
|
||||
'edit_posts' => 'edit_products',
|
||||
'edit_others_posts' => 'edit_others_products',
|
||||
'publish_posts' => 'publish_products',
|
||||
'read_private_posts' => 'read_private_products',
|
||||
'create_posts' => 'create_products', // use `create_products` instead of default `edit_products`
|
||||
);
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user