← All changes
|
src/Addons/RoleBasedPricing/Export/RoleBasedPricingExport.php
+8
-0
6.1.0
→
8.0.2
View file →
| @@ -19,10 +19,14 @@ | ||
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $columns = array(); |
| 23 | + $disabled_roles = apply_filters( 'tiered_pricing_table/role_based_rules/import_export_disabled_roles', array( 'editor', 'author', 'contributor', 'shop_manager' ) ); | |
| 23 | 24 | |
| 24 | 25 | foreach ( wp_roles()->roles as $WPRole => $role_data ) { |
| 26 | + if ( in_array( $WPRole, $disabled_roles, true ) ) { | |
| 27 | + continue; | |
| 28 | + } | |
| 25 | 29 | |
| 26 | 30 | $columns[] = array( |
| 27 | 31 | 'column_title' => $WPRole . '_tiered_price_pricing_type', |
| 28 | 32 | 'export_callback' => function ( $value, WC_Product $product ) use ( $WPRole ) { |
| @@ -111,10 +115,14 @@ | ||
| 111 | 115 | */ |
| 112 | 116 | public function addExportColumn( array $columns ): array { |
| 113 | 117 | |
| 114 | 118 | global $wp_roles; |
| 119 | + $disabled_roles = apply_filters( 'tiered_pricing_table/role_based_rules/import_export_disabled_roles', array( 'editor', 'author', 'contributor', 'shop_manager' ) ); | |
| 115 | 120 | |
| 116 | 121 | foreach ( wp_roles()->roles as $WPRole => $role_data ) { |
| 122 | + if ( in_array( $WPRole, $disabled_roles, true ) ) { | |
| 123 | + continue; | |
| 124 | + } | |
| 117 | 125 | |
| 118 | 126 | $roleName = isset( $wp_roles->role_names[ $WPRole ] ) ? translate_user_role( $wp_roles->role_names[ $WPRole ] ) : $WPRole; |
| 119 | 127 | |
| 120 | 128 | $columns[ $WPRole . '_tiered_price_pricing_type' ] = 'Tiered Pricing — ' . ' [' . $roleName . '] ' . __( 'Regular pricing type', |