Created
October 26, 2016 02:43
-
-
Save pingram3541/831aecf628165b5f36f856303b23b5be to your computer and use it in GitHub Desktop.
Elementor content conforms to page assigned Paid Memberships Pro membership levels - /elementor/includes/frontend.php L315
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from functions.php -