parent
0fd7e3376d
commit
a7538da23b
|
@ -520,7 +520,7 @@ class WC_Install {
|
||||||
'view_woocommerce_reports'
|
'view_woocommerce_reports'
|
||||||
);
|
);
|
||||||
|
|
||||||
$capability_types = array( 'product', 'shop_order', 'shop_coupon' );
|
$capability_types = array( 'product', 'shop_order', 'shop_coupon', 'shop_webhook' );
|
||||||
|
|
||||||
foreach ( $capability_types as $capability_type ) {
|
foreach ( $capability_types as $capability_type ) {
|
||||||
|
|
||||||
|
|
|
@ -123,3 +123,42 @@ $update_variations = $wpdb->get_col( "
|
||||||
foreach ( $update_variations as $variation_id ) {
|
foreach ( $update_variations as $variation_id ) {
|
||||||
add_post_meta( $variation_id, '_manage_stock', 'yes', true );
|
add_post_meta( $variation_id, '_manage_stock', 'yes', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add webhook capabilities to shop_manager/administrator role
|
||||||
|
global $wp_roles;
|
||||||
|
|
||||||
|
if ( class_exists( 'WP_Roles' ) ) {
|
||||||
|
if ( ! isset( $wp_roles ) ) {
|
||||||
|
$wp_roles = new WP_Roles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( is_object( $wp_roles ) ) {
|
||||||
|
$webhook_capabilities = array(
|
||||||
|
// post type
|
||||||
|
'edit_shop_webhook',
|
||||||
|
'read_shop_webhook',
|
||||||
|
'delete_shop_webhook',
|
||||||
|
'edit_shop_webhooks',
|
||||||
|
'edit_others_shop_webhooks',
|
||||||
|
'publish_shop_webhooks',
|
||||||
|
'read_private_shop_webhooks',
|
||||||
|
'delete_shop_webhooks',
|
||||||
|
'delete_private_shop_webhooks',
|
||||||
|
'delete_published_shop_webhooks',
|
||||||
|
'delete_others_shop_webhooks',
|
||||||
|
'edit_private_shop_webhooks',
|
||||||
|
'edit_published_shop_webhooks',
|
||||||
|
|
||||||
|
// terms
|
||||||
|
'manage_shop_webhook_terms',
|
||||||
|
'edit_shop_webhook_terms',
|
||||||
|
'delete_shop_webhook_terms',
|
||||||
|
'assign_shop_webhook_terms'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $webhook_capabilities as $cap ) {
|
||||||
|
$wp_roles->add_cap( 'shop_manager', $cap );
|
||||||
|
$wp_roles->add_cap( 'administrator', $cap );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue