| 1 |
<?php |
| 2 |
/** |
| 3 |
* Products Visibility By User Roles plugin support. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Controllers\PluginsSupport; |
| 9 |
|
| 10 |
use RadiusTheme\SB\Traits\SingletonTrait; |
| 11 |
|
| 12 |
// Do not allow directly accessing this file. |
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit( 'This script cannot be accessed directly.' ); |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* WooCommerce address book plugin support |
| 19 |
*/ |
| 20 |
class AddifyVisibilityByRoles { |
| 21 |
/** |
| 22 |
* SingletonTrait. |
| 23 |
*/ |
| 24 |
use SingletonTrait; |
| 25 |
|
| 26 |
/** |
| 27 |
* Construct function |
| 28 |
*/ |
| 29 |
private function __construct() { |
| 30 |
if ( ! class_exists( 'Addify_Products_Visibility_Front' ) ) { |
| 31 |
return; |
| 32 |
} |
| 33 |
|
| 34 |
add_action( 'rtsb/elements/render/product_query', [ $this, 'modify_query' ], 99 ); |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Modify product query. |
| 39 |
* |
| 40 |
* @param object $product_query Product Query. |
| 41 |
* |
| 42 |
* @return void |
| 43 |
*/ |
| 44 |
public function modify_query( $product_query ) { |
| 45 |
$custom_visibility = new \Addify_Products_Visibility_Front(); |
| 46 |
$custom_visibility->afpvu_custom_pre_get_posts_query( $product_query ); |
| 47 |
} |
| 48 |
} |
| 49 |
|