/**
  * Members compatibility
  * Show Builder contents only if user has access
  *
  * @return bool
  */
 public function members_themify_builder_display($display, $post_id)
 {
     if (!members_can_current_user_view_post($post_id)) {
         return false;
     }
     return $display;
 }
/**
 * Disables the comments template if a user doesn't have permission to view the post the comments are 
 * associated with.
 *
 * @since 0.1.0
 * @param string $template The Comments template.
 * @return string $template
 */
function members_content_permissions_comments($template)
{
    /* Check if the current user has permission to view the comments' post. */
    if (!members_can_current_user_view_post(get_queried_object_id())) {
        /* Look for a 'comments-no-access.php' template in the parent and child theme. */
        $has_template = locate_template(array('comments-no-access.php'));
        /* If the template was found, use it.  Otherwise, fall back to the Members comments.php template. */
        $template = !empty($has_template) ? $has_template : MEMBERS_INCLUDES . 'comments.php';
        /* Allow devs to overwrite the comments template. */
        $template = apply_filters('members_comments_template', $template);
    }
    /* Return the comments template filename. */
    return $template;
}
Exemple #3
0
function limit_access($value, $post_id, $field)
{
    if (!is_admin()) {
        $url = esc_url(get_permalink($post_id));
        //If the user is in the sales section
        $url = strpos($url, 'sales');
        if (!members_can_current_user_view_post($post_id)) {
            $value = members_get_post_error_message($post_id) . members_login_form_shortcode();
        } else {
            if (members_can_current_user_view_post($post_id) && is_user_logged_in() && $field['name'] == 'content' && $url > 0) {
                $value = '<div class="loginout">' . wp_loginout(get_permalink($post_id), false) . '</div>' . $value;
            }
        }
    }
    return $value;
}
 /**
  * Hook to content filter to show builder output
  * @param $content
  * @return string
  */
 function builder_show_on_front($content)
 {
     global $post, $wp_query;
     if (is_admin()) {
         return $content;
     }
     // Disable builder on admin post list
     if (is_post_type_archive() && !is_post_type_archive('product') || post_password_required() || isset($wp_query->query_vars['product_cat']) || is_tax('product_tag')) {
         return $content;
     }
     if (is_singular('product') && 'product' == get_post_type()) {
         return $content;
     }
     // dont show builder on product single description
     if (is_post_type_archive('product') && get_query_var('paged') == 0 && $this->builder_is_plugin_active('woocommerce/woocommerce.php')) {
         $post = get_post(woocommerce_get_page_id('shop'));
     }
     if (!is_object($post)) {
         return $content;
     }
     // Paid Membership Pro
     if (defined('PMPRO_VERSION')) {
         $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];
             $post_membership_levels_names = $hasaccess[2];
             $hasaccess = $hasaccess[0];
         }
         if (!$hasaccess) {
             return $content;
         }
     }
     // Members
     if (class_exists('Members_Load')) {
         if (!members_can_current_user_view_post(get_the_ID())) {
             return $content;
         }
     }
     // Infinite-loop prevention
     if (empty($this->post_ids)) {
         $this->post_ids[] = $post->ID;
     } elseif (in_array($post->ID, $this->post_ids)) {
         // we have already rendered this, go back.
         return $content;
     }
     $this->post_ids[] = $post->ID;
     $builder_data = $this->get_builder_data($post->ID);
     if (!is_array($builder_data) || strpos($content, '#more-')) {
         $builder_data = array();
     }
     if ($this->in_the_loop) {
         $content .= $this->retrieve_template('builder-output-in-the-loop.php', array('builder_output' => $builder_data, 'builder_id' => $post->ID), '', '', false);
     } else {
         $content .= $this->retrieve_template('builder-output.php', array('builder_output' => $builder_data, 'builder_id' => $post->ID), '', '', false);
     }
     if (array_shift($this->post_ids) == $post->ID) {
         // the loop is finished, reset the ID list
         $this->post_ids = array();
     }
     return $content;
 }
<?php

/**
 * The Template for displaying all single video posts with standard layout.
 *
 */
$have_access = members_can_current_user_view_post(get_the_ID()) && !post_password_required();
get_header();
$layout = ot_get_option('single_layout_ct_video', 'right');
$layout_ct_video = get_post_meta($post->ID, 'single_ly_ct_video', true);
if ($layout_ct_video != 'def') {
    $layout = $layout_ct_video;
}
global $sidebar_width;
?>
<div id="body">
        <div class="container">
            <div class="row">
  				<div id="content" class="<?php 
echo $layout != 'full' ? $sidebar_width ? 'col-md-9' : 'col-md-8' : 'col-md-12';
echo $layout == 'left' ? " revert-layout" : "";
?>
" role="main">
                	<?php 
//content
if (have_posts()) {
    $get_layout = get_post_meta($post->ID, 'page_layout', true);
    if ($get_layout == 'def' || $get_layout == '') {
        $get_layout = ot_get_option('single_layout_video');
    }
    if ($get_layout == 'inbox') {
Exemple #6
0
} else {
    global $post;
    if ($post) {
        $global_title = $post->post_title;
    }
}
get_template_part('header', 'navigation');
// load header-navigation.php
if (is_single() && !is_attachment()) {
    if (tm_is_post_video()) {
        $get_layout = get_post_meta($post->ID, 'page_layout', true);
        if ($get_layout == 'def' || $get_layout == '') {
            $get_layout = ot_get_option('single_layout_video');
        }
        if ($get_layout != 'inbox') {
            if (members_can_current_user_view_post(get_the_ID()) && !post_password_required()) {
                get_template_part('header', 'single-player');
            }
        }
    } else {
        get_template_part('header', 'single');
    }
} elseif (is_category() && !is_search()) {
    get_template_part('header', 'category');
} elseif (is_front_page() || is_page_template('page-templates/front-page.php')) {
    get_template_part('header', 'frontpage');
} elseif (is_plugin_active('buddypress/bp-loader.php') && bp_is_current_component('playlist')) {
    get_template_part('header', 'playlist');
}
global $sidebar_width;
$sidebar_width = ot_get_option('sidebar_width');
 /**
  * Builder integration with Members plugin
  * Display the Builder contents only if user has permission to view the post contents
  *
  * @since 1.1.8
  * @return string $content
  */
 function members_builder_show_on_front($content)
 {
     global $ThemifyBuilder;
     if (members_can_current_user_view_post(get_the_ID())) {
         $content = $ThemifyBuilder->builder_show_on_front($content);
     }
     return $content;
 }
/**
 * Disables the comments template if a user doesn't have permission to view the post the
 * comments are associated with.
 *
 * @since  0.1.0
 * @param  string  $template
 * @return string
 */
function members_content_permissions_comments($template)
{
    // Check if the current user has permission to view the comments' post.
    if (!members_can_current_user_view_post(get_the_ID())) {
        // Look for a 'comments-no-access.php' template in the parent and child theme.
        $has_template = locate_template(array('comments-no-access.php'));
        // If the template was found, use it.  Otherwise, fall back to the Members comments.php template.
        $template = $has_template ? $has_template : members_plugin()->templates_dir . 'comments.php';
        // Allow devs to overwrite the comments template.
        $template = apply_filters('members_comments_template', $template);
    }
    // Return the comments template filename.
    return $template;
}