PluginProbe
Themify Builder / 7.7.0
Themify Builder v7.7.0
7.8.1 7.8.0 7.7.9 7.7.8 7.7.7 7.7.6 7.7.5 7.7.4 7.7.3 7.7.2 trunk 7.6.0 7.6.1 7.6.2 7.6.3 7.6.4 7.6.5 7.6.6 7.6.7 7.6.8 7.6.9 7.7.0 7.7.1
themify-builder / includes / plugin-compat / pmpro.php

pmpro.php in Themify Builder 7.7.0, at includes/plugin-compat/pmpro.php

35 lines 1020 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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/paid-memberships-pro/
11 */
12 class Themify_Builder_Plugin_Compat_PMPro {
13
14 static function init() {
15 add_filter( 'themify_builder_display', array( __CLASS__, 'pmpro_themify_builder_display' ), 10, 2 );
16 }
17
18 /**
19 * Paid Membership Pro
20 * Show Builder contents only if user has access
21 *
22 * @access public
23 * @return bool
24 */
25 public static function pmpro_themify_builder_display(bool $display,?int $post_id ):bool {
26 $hasaccess = pmpro_has_membership_access( NULL, NULL, true );
27 if( is_array( $hasaccess ) ) {
28 //returned an array to give us the membership level values
29 $post_membership_levels_ids = $hasaccess[1];
30 $post_membership_levels_names = $hasaccess[2];
31 $hasaccess = $hasaccess[0];
32 }
33 return ! $hasaccess?false:$display;
34 }
35 }