PluginProbe
Tiered Pricing Table for WooCommerce / 8.0.2
Tiered Pricing Table for WooCommerce v8.0.2
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
← All changes | src/Addons/RoleBasedPricing/Import/RoleBasedPricingImport.php +17 -1 6.1.0 → 8.0.2 View file →
@@ -1,8 +1,8 @@
1 1 <?php namespace TierPricingTable\Addons\RoleBasedPricing\Import;
2 2
3 3 use TierPricingTable\Addons\RoleBasedPricing\RoleBasedPricingRule;
4 -use TierPricingTable\Services\ImportExport\WoocommerceImportService;
4 +use TierPricingTable\Addons\ImportExport\WoocommerceImportService;
5 5 use WC_Product;
6 6
7 7 class RoleBasedPricingImport {
8 8
@@ -14,10 +14,16 @@
14 14 }
15 15
16 16 public function processImport( WC_Product $product, array $data ): WC_Product {
17 17
18 + $disabled_roles = apply_filters( 'tiered_pricing_table/role_based_rules/import_export_disabled_roles', array( 'editor', 'author', 'contributor', 'shop_manager' ) );
19 +
18 20 foreach ( wp_roles()->roles as $WPRole => $role_data ) {
19 21
22 + if ( in_array( $WPRole, $disabled_roles, true ) ) {
23 + continue;
24 + }
25 +
20 26 $roleBasedRule = new RoleBasedPricingRule( $product->get_id(), $WPRole );
21 27 $needUpdate = false;
22 28
23 29 if ( isset( $data[ $WPRole . '_tiered_price_pricing_type' ] ) ) {
@@ -98,10 +104,15 @@
98 104
99 105 public function addColumnsToImporter( $columns ): array {
100 106
101 107 global $wp_roles;
108 + $disabled_roles = apply_filters( 'tiered_pricing_table/role_based_rules/import_export_disabled_roles', array( 'editor', 'author', 'contributor', 'shop_manager' ) );
102 109
103 110 foreach ( wp_roles()->roles as $WPRole => $role_data ) {
111 + if ( in_array( $WPRole, $disabled_roles, true ) ) {
112 + continue;
113 + }
114 +
104 115 $roleName = isset( $wp_roles->role_names[ $WPRole ] ) ? translate_user_role( $wp_roles->role_names[ $WPRole ] ) : $WPRole;
105 116
106 117 $columns[ 'tpt_' . $WPRole ] = array(
107 118 'name' => __( 'Tiered Pricing', 'tier-pricing-table' ) . ': ' . $roleName,
@@ -131,10 +142,15 @@
131 142
132 143 public function addColumnsToMapper( array $columns ): array {
133 144
134 145 global $wp_roles;
146 + $disabled_roles = apply_filters( 'tiered_pricing_table/role_based_rules/import_export_disabled_roles', array( 'editor', 'author', 'contributor', 'shop_manager' ) );
135 147
136 148 foreach ( wp_roles()->roles as $WPRole => $role_data ) {
149 + if ( in_array( $WPRole, $disabled_roles, true ) ) {
150 + continue;
151 + }
152 +
137 153 $roleName = isset( $wp_roles->role_names[ $WPRole ] ) ? translate_user_role( $wp_roles->role_names[ $WPRole ] ) : $WPRole;
138 154
139 155 $columns[ 'Tiered Pricing — [' . $roleName . '] Regular pricing type' ] = $WPRole . '_tiered_price_pricing_type';
140 156