| 1 |
<?php |
| 2 |
/** |
| 3 |
* Builder Plugin Compatibility Code |
| 4 |
* |
| 5 |
* @package Themify_Builder |
| 6 |
* @subpackage Themify_Builder/classes |
| 7 |
*/ |
| 8 |
|
| 9 |
/** |
| 10 |
* @link https://wordpress.org/plugins/members/ |
| 11 |
*/ |
| 12 |
class Themify_Builder_Plugin_Compat_Members { |
| 13 |
|
| 14 |
static function init() { |
| 15 |
add_filter( 'themify_builder_display', array( __CLASS__, 'members_themify_builder_display' ), 10, 2 ); |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Members compatibility |
| 20 |
* Show Builder contents only if user has access |
| 21 |
* |
| 22 |
* @access public |
| 23 |
* @return bool |
| 24 |
*/ |
| 25 |
public static function members_themify_builder_display(bool $display,?int $post_id ):bool { |
| 26 |
return ! members_can_current_user_view_post( $post_id ) ? false : $display; |
| 27 |
} |
| 28 |
} |