Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Restricted Customer issue
- add_filter( 'wcfm_is_component_for_vendor', function( $is_component_for_vendor, $component_id, $component, $current_vendor ) {
- if ( 'customer' != $component ) return $is_component_for_vendor;
- global $wpdb;
- $sql = $wpdb->prepare(
- "SELECT `order_id` FROM {$wpdb->prefix}wcfm_marketplace_orders WHERE `vendor_id`=%d AND `customer_id`=%d",
- $current_vendor,
- $component_id
- );
- $has_orders = $wpdb->get_results( $sql );
- if ( is_array( $has_orders ) && !empty( $has_orders ) ) $is_component_for_vendor = true;
- return $is_component_for_vendor;
- }, 10, 4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement