public function apply_builder_in_content( $content ) {
if ( ! $this->_is_frontend_mode )
return $content;
$post_id = get_the_ID();
if ( post_password_required( $post_id ) )
return $content;
$data = Plugin::instance()->db->get_plain_editor( $post_id );
$edit_mode = Plugin::instance()->db->get_edit_mode( $post_id );
if ( empty( $data ) || 'builder' !== $edit_mode )
return $content;
/* custom code to filter paid membership pro */
$hasaccess = pmpro_has_membership_access(NULL, NULL, true);
if(is_array($hasaccess)){
//returned an array to give us the membership level values
//$post_membership_levels_ids = $hasaccess[1]; //gives us all level ids
//$post_membership_levels_names = $hasaccess[2]; //gives us the level names
$hasaccess = $hasaccess[0];
}
if($hasaccess){
ob_start(); ?>
<div id="elementor" class="elementor">
<div id="elementor-inner">
<div id="elementor-section-wrap">
<?php $this->_print_sections( $data ); ?>
</div>
</div>
</div>
<?php
return apply_filters( 'elementor/frontend/the_content', ob_get_clean() );
} else {
ob_start(); ?>
<div id="elementor" class="elementor container">
<div id="elementor-inner">
<div id="elementor-section-wrap">
<div class="pmpro_content_message"><br><br>This content is for GoFit Concepts Monthly Program members only.<br><a href="<?php echo wp_login_url( get_permalink() ) ?>">Log In</a> <a href="<?php echo esc_url( wp_registration_url() ); ?>"><?php esc_html_e( 'Register', 'textdomain' ); ?></a></div>
</div>
</div>
</div>
<?php
return apply_filters( 'elementor/frontend/the_content', ob_get_clean() );
}
}