当前位置: 首页>>代码示例>>PHP>>正文


PHP pmpro_has_membership_access函数代码示例

本文整理汇总了PHP中pmpro_has_membership_access函数的典型用法代码示例。如果您正苦于以下问题:PHP pmpro_has_membership_access函数的具体用法?PHP pmpro_has_membership_access怎么用?PHP pmpro_has_membership_access使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pmpro_has_membership_access函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pmpro_xmlrpc_hasMembershipAccess

/**
 * API method to check if a user has access to a certain post.
 * Since v2.0
 */
function pmpro_xmlrpc_hasMembershipAccess($args)
{
    // Parse the arguments, assuming they're in the correct order
    $username = $args[0];
    $password = $args[1];
    $post_id = $args[2];
    //post id to check
    $user_id = $args[3];
    //optional user id passed in
    $return_membership_levels = $args[4];
    //option to also include an array of membership levels with access to the post
    global $wp_xmlrpc_server;
    // Let's run a check to see if credentials are okay
    if (!($user = $wp_xmlrpc_server->login($username, $password))) {
        return $wp_xmlrpc_server->error;
    }
    // The user passed should be an admin or have the pmpro_xmlprc capability
    if (!user_can($user->ID, "manage_options") && !user_can($user->ID, "pmpro_xmlrpc")) {
        return "ERROR: User does not have access to the PMPro XMLRPC methods.";
    }
    // Default to logged in user if no user_id is given.
    if (empty($user_id)) {
        $user_id = $user->ID;
    }
    $has_access = pmpro_has_membership_access($post_id, $user_id, $return_membership_levels);
    return $has_access;
}
开发者ID:srinivasulurao,项目名称:transcharity,代码行数:31,代码来源:xmlrpc.php

示例2: pmprocpt_template_redirect

function pmprocpt_template_redirect()
{
    $selected_cpts = pmprocpt_getCPTs();
    $options = get_option('pmprocpt_options');
    $redirect_to = intval($options['redirect_to'][0]);
    if (!pmpro_has_membership_access() && is_singular($selected_cpts) && !empty($redirect_to)) {
        //wp_redirect(pmpro_url('levels');
        wp_redirect(get_permalink($redirect_to));
        exit;
    }
}
开发者ID:eighty20results,项目名称:pmpro-cpt,代码行数:11,代码来源:pmpro-cpt.php

示例3: pmpro_themify_builder_display

 /**
  * Paid Membership Pro
  * Show Builder contents only if user has access
  *
  * @return bool
  */
 public function pmpro_themify_builder_display($display, $post_id)
 {
     $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 false;
     }
     return $display;
 }
开发者ID:tchataigner,项目名称:palette,代码行数:20,代码来源:class-themify-builder-plugin-compat.php

示例4: membership_okay

function membership_okay()
{
    if (function_exists("pmpro_membership_content_filter")) {
        $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];
        }
        return $hasaccess;
    }
    return true;
    // default to a true return if membership pro is not installed
}
开发者ID:BYU-ODH,项目名称:byu-humanities-department,代码行数:15,代码来源:flexible-content.php

示例5: acceptance_videos_func

function acceptance_videos_func($atts)
{
    global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
    $type = 'video';
    $max_count = 0;
    /*
     +===================================+
     | BEGIN 'Acceptance'                |
     +===================================+
    */
    $acceptance = array();
    $empty_acceptance = true;
    $args = array('post_type' => array($type), 'post_status' => 'publish', 'caller_get_posts' => 1, 'tax_query' => array(array('taxonomy' => 'categories', 'field' => 'slug', 'terms' => 'acceptance')));
    $acceptance_query = null;
    $acceptance_query = new WP_Query($args);
    if ($acceptance_query->have_posts()) {
        while ($acceptance_query->have_posts()) {
            $acceptance_query->the_post();
            $thumbnail = "";
            $video_thumbnail_url = get_field('video_thumbnail', $post_id = $post->ID);
            if (!empty($video_thumbnail_url)) {
                $thumbnail = '<img src="' . $video_thumbnail_url . '" alt="" class="img-responsive">';
            }
            $col = '<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">' . '<a class="dashboard-stat acceptance dashboard-stat-light blue-soft" href="' . get_the_permalink($post_id = $post->ID) . '">' . '<div class="visual">' . '<div class="overlay"></div>' . $thumbnail . '</div>' . '<div class="details">' . '<div class="number">' . the_title($before = '', $after = '', $echo = false) . '</div>' . '</div>' . '<span class="caption-helper">' . '<ul class="post-meta clr">' . '<li class="meta-date">' . 'Posted on <span class="meta-date-text">' . get_the_date() . '</span>' . '</li>' . '</ul><!-- .post-meta -->' . '</span>' . '</a>' . '</div>';
            $hasaccess = pmpro_has_membership_access($post_id = $post->ID, $user_id = $current_user->ID, $return_membership_levels = false);
            if ($hasaccess) {
                $acceptance[] = $col;
            }
        }
    }
    $tmp = count($acceptance);
    if ($tmp > $max_count) {
        $max_count = $tmp;
    }
    wp_reset_query();
    ?>
    <!-- BEGIN VIDEOS MENU-->
    <div class="row top-category">
        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <div class="easy-pie-chart">
                <div class="number bounce" data-percent="46">
                    <img src="<?php 
    echo get_template_directory_uri();
    ?>
/assets/global/img/acceptance-color.png" alt="" class=""/>
                </div>
                <a class="title" href="#">
                    Acceptance
                </a>
            </div>
        </div>
    </div>
    <div class="clearfix">
    </div>
    <div class="page-bar" style="height: 16px; width: 80%; text-align: center; margin: auto auto 75px auto;padding-top: 7px;">
        <div class="line" style="width: 100%; color: #1977ba; border-top: 2px dotted #1977ba; margin: auto;"></div>

        <div class="line-left" style=" padding: 0px 0px 0px 7px; background-color: #ffffff; height: 45px;width: 16px; margin-top: -2px;  float: left;">
            <div class="line" style="color: #1977ba;  border-left: 2px dotted #1977ba;   margin: auto; height: 100%; position: relative; display: block;">
                <div class="arrow-down" style=" width: 0px;   height: 0px;   border-left: 20px solid transparent;   border-right: 20px solid transparent;  border-top: 20px solid #FFF; bottom: -18px;position: absolute; left: -21px;">
                </div>
            </div>
        </div>

        <div class="middle-container-left" style="display: block; position: relative; width: 47%; float: left; margin: auto; text-align: center;">
            <div class="line-middle" style="padding: 0px 0px 0px 7px;   background-color: #ffffff; height: 45px; width: 16px; margin-top: -2px; margin:-2px 29% auto auto; text-align: center;">
                <div class="line" style="color: #1977ba; border-left: 2px dotted #1977ba;  margin: auto; height: 100%; position: relative; display: block;">
                    <div class="arrow-down" style="width: 0px;   height: 0px;   border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 20px solid #FFF; bottom: -18px; position: absolute; left: -21px;">
                    </div>
                </div>
            </div>
        </div>          
        <div class="middle-container-right" style="display: block; position: relative; width: 48%; float: left; margin: auto; text-align: center;">
            <div class="line-middle-right" style="padding: 0px 0px 0px 7px; background-color: #ffffff; height: 45px; width: 16px; margin-top: -2px; margin: -2px auto auto 35%; text-align: center;">
                <div class="line" style="color: #1977ba; border-left: 2px dotted #1977ba; margin: auto;  height: 100%; position: relative; display: block;">
                    <div class="arrow-down" style="width: 0px; height: 0px;  border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 20px solid #FFF; bottom: -18px; position: absolute; left: -21px; ">
                    </div>
                </div>
            </div>
        </div>
        <div class="line-right" style="padding: 0px 0px 0px 7px;   background-color: #ffffff; height: 45px; width: 16px; margin-top: -2px; float: right; ">
            <div class="line" style="color: #1977ba; border-left: 2px dotted #1977ba; margin: auto; height: 100%; position: relative; display: block;">
                <div class="arrow-down" style="width: 0px;   height: 0px;   border-left: 20px solid transparent;   border-right: 20px solid transparent; border-top: 20px solid #FFF; bottom: -18px; position: absolute; left: -21px;">
                </div>   
            </div>
        </div>
    </div>
    <div class="clearfix">
    </div>
    <!-- END VIDEOS MENU-->
    <!-- BEGIN VIDEO LIST-->
    <div class="row init-row">
        <?php 
    for ($i = 0; $i <= $max_count; $i++) {
        ?>

            <?php 
        if (isset($acceptance[$i])) {
            echo $acceptance[$i];
        } else {
//.........这里部分代码省略.........
开发者ID:TakenCdosG,项目名称:admissionsrevolution_new,代码行数:101,代码来源:shortcode_last.php

示例6: builder_show_on_front

 /**
  * 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;
 }
开发者ID:rgrasiano,项目名称:viabasica-hering,代码行数:67,代码来源:class-themify-builder.php

示例7: pmpro_body_classes

/**
 * Adds custom classes to the array of body classes.
 * Same as the above, but acts on the "queried object" instead of the post global.
 *
 * pmpro-body-level-required = this post requires at least one level
 * pmpro-body-level-1 = this post requires level 1
 * pmpro-body-has-access = this post is usually locked, but the current user has access to this post
 *
 * @param array $classes Classes for the body element.
 * @return array
 *
 * @since 1.8.6.1
 */
function pmpro_body_classes($classes)
{
    $post = get_queried_object();
    if (empty($post) || !is_singular()) {
        return $classes;
    }
    $post_levels = array();
    $post_levels = pmpro_has_membership_access($post->ID, NULL, true);
    if (!empty($post_levels)) {
        if (!empty($post_levels[1])) {
            $classes[] = 'pmpro-body-level-required';
            foreach ($post_levels[1] as $post_level) {
                $classes[] = 'pmpro-body-level-' . $post_level[0];
            }
        }
        if (!empty($post_levels[0]) && $post_levels[0] == true) {
            $classes[] = 'pmpro-body-has-access';
        }
    }
    return $classes;
}
开发者ID:MediaPreneur,项目名称:paid-memberships-pro,代码行数:34,代码来源:content.php

示例8: pmpro_post_classes

/**
 * Adds custom classes to the array of post classes.
 *
 * pmpro-level-required = this post requires at least one level
 * pmpro-level-1 = this post requires level 1
 * pmpro-has-access = this post is usually locked, but the current user has access to this post
 *
 * @param array $classes Classes for the post element.
 * @return array
 *
 * @since 1.8.5.4
 */
function pmpro_post_classes($classes)
{
    global $post;
    $post_levels = array();
    $post_levels = pmpro_has_membership_access($post->ID, NULL, true);
    if (!empty($post_levels)) {
        if (!empty($post_levels[1])) {
            $classes[] = 'pmpro-level-required';
            foreach ($post_levels[1] as $post_level) {
                $classes[] = 'pmpro-level-' . $post_level[0];
            }
        }
        if (!empty($post_levels[0]) && $post_levels[0] == true) {
            $classes[] = 'pmpro-has-access';
        }
    }
    return $classes;
}
开发者ID:srimai,项目名称:paid-memberships-pro,代码行数:30,代码来源:content.php

示例9: get_header

<?php

/**
 * The Template for displaying all single posts.
 *
 * @package WordPress
 * @subpackage Elegant WPExplorer Theme
 * @since Elegant 1.0
 */
get_header("dashboard");
global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
$return_membership_levels = pmpro_has_membership_access($post_id = $post->ID, $user_id = $current_user->ID, $return_membership_levels = true);
if (empty($return_membership_levels[2]) && $return_membership_levels[0]) {
    $hasaccess = FALSE;
} else {
    $hasaccess = $return_membership_levels[0];
}
if ($hasaccess) {
    ?>
    <!-- BEGIN CONTENT -->
    <div class="page-content-wrapper">
        <div class="page-content">
            <div class="row">
                <div class="col-md-8 col-sm-8 col-sm-offset-2 col-md-offset-2">
                    <!-- BEGIN PORTLET-->
                    <?php 
    while (have_posts()) {
        the_post();
        ?>
                        <?php 
        $term_list = wp_get_post_terms($post->ID, 'categories', array("fields" => "all"));
开发者ID:TakenCdosG,项目名称:admissionsrevolution_new,代码行数:31,代码来源:single-video.php

示例10: pmproap_getLevelIDForCheckoutLink

function pmproap_getLevelIDForCheckoutLink($post_id = NULL, $user_id = NULL)
{
    global $current_user, $post;
    //default to current user
    if (empty($user_id) && !empty($current_user) && !empty($current_user->ID)) {
        $user_id = $current_user->ID;
    }
    //default to current post
    if (empty($post_id) && !empty($post) && !empty($post->ID)) {
        $post_id = $post->ID;
    }
    //no post, we bail
    if (empty($post_id)) {
        return false;
    }
    //no user id? make sure it's null
    if (empty($user_id)) {
        $user_id = NULL;
    }
    //use current level or offer a free level checkout
    $has_access = pmpro_has_membership_access($post_id, $user_id, true);
    $post_levels = $has_access[1];
    //make sure membership_level obj is populated
    if (is_user_logged_in()) {
        $current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);
    }
    if (!empty($current_user->membership_level) && in_array($current_user->membership_level->ID, $post_levels)) {
        $text_level_id = $current_user->membership_level->id;
    } elseif (!empty($post_levels)) {
        //find a free level to checkout with
        foreach ($post_levels as $post_level_id) {
            $post_level = pmpro_getLevel($post_level_id);
            if (pmpro_isLevelFree($post_level)) {
                $text_level_id = $post_level->id;
                break;
            }
        }
    }
    //didn't find a level id to use yet? return false and user's will be linked to the levels page.
    if (empty($text_level_id)) {
        $text_level_id = false;
    }
    return $text_level_id;
}
开发者ID:greathmaster,项目名称:pmpro-addon-packages,代码行数:44,代码来源:pmpro-addon-packages.php

示例11: pmpro_hide_pages_redirect

function pmpro_hide_pages_redirect()
{
    global $post;
    if (!is_admin() && !empty($post->ID)) {
        if ($post->post_type == "attachment") {
            //check if the user has access to the parent
            if (!pmpro_has_membership_access($post->ID)) {
                wp_redirect(pmpro_url("levels"));
                exit;
            }
        }
    }
}
开发者ID:javierdlahoz,项目名称:dcbia-wp,代码行数:13,代码来源:content.php

示例12:

<?php

/**
 * PMPro custom template output for a download via the [download] shortcode
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $current_user;
if (function_exists('pmpro_hasMembershipLevel')) {
    if (!pmpro_has_membership_access($dlm_download->id)) {
        $download_membership_levels = pmprodlm_getDownloadLevels($dlm_download);
        if ($dlm_download->exists()) {
            ?>
			<a class="download-link" href="
			<?php 
            if (count($download_membership_levels[0]) > 1) {
                echo pmpro_url('levels');
            } else {
                echo pmpro_url("checkout", "?level=" . $download_membership_levels[0][0], "https");
            }
            ?>
"><?php 
            echo $dlm_download->get_the_title();
            ?>
</a>
			<?php 
            _e('Membership Required', 'pmprodlm');
            ?>
: <?php 
开发者ID:strangerstudios,项目名称:pmpro-download-monitor,代码行数:31,代码来源:content-download-pmpro_title.php

示例13: pmprodlm_dlm_no_access_after_message

function pmprodlm_dlm_no_access_after_message($download)
{
    global $current_user;
    if (function_exists('pmpro_hasMembershipLevel')) {
        if (!pmpro_has_membership_access($download->id)) {
            $hasaccess = pmpro_has_membership_access($download->id, 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 (empty($post_membership_levels_ids)) {
                $post_membership_levels_ids = array();
            }
            if (empty($post_membership_levels_names)) {
                $post_membership_levels_names = array();
            }
            //hide levels which don't allow signups by default
            if (!apply_filters("pmpro_membership_content_filter_disallowed_levels", false, $post_membership_levels_ids, $post_membership_levels_names)) {
                foreach ($post_membership_levels_ids as $key => $id) {
                    //does this level allow registrations?
                    $level_obj = pmpro_getLevel($id);
                    if (!$level_obj->allow_signups) {
                        unset($post_membership_levels_ids[$key]);
                        unset($post_membership_levels_names[$key]);
                    }
                }
            }
            $pmpro_content_message_pre = '<div class="pmpro_content_message">';
            $pmpro_content_message_post = '</div>';
            $content = '';
            $sr_search = array("!!levels!!", "!!referrer!!");
            $sr_replace = array(pmpro_implodeToEnglish($post_membership_levels_names), urlencode(site_url($_SERVER['REQUEST_URI'])));
            //get the correct message to show at the bottom
            if ($current_user->ID) {
                //not a member
                $newcontent = apply_filters("pmpro_non_member_text_filter", stripslashes(pmpro_getOption("nonmembertext")));
                $content .= $pmpro_content_message_pre . str_replace($sr_search, $sr_replace, $newcontent) . $pmpro_content_message_post;
            } else {
                //not logged in!
                $newcontent = apply_filters("pmpro_not_logged_in_text_filter", stripslashes(pmpro_getOption("notloggedintext")));
                $content .= $pmpro_content_message_pre . str_replace($sr_search, $sr_replace, $newcontent) . $pmpro_content_message_post;
            }
        }
    }
    echo $content;
}
开发者ID:strangerstudios,项目名称:pmpro-download-monitor,代码行数:48,代码来源:pmpro-download-monitor.php

示例14: pmpros_pmpro_text_filter

function pmpros_pmpro_text_filter($text)
{
    global $wpdb, $current_user, $post;
    if (!empty($current_user) && !empty($post)) {
        if (!pmpros_hasAccess($current_user->ID, $post->ID)) {
            //Update text. The either have to wait or sign up.
            $post_series = get_post_meta($post->ID, "_post_series", true);
            $inseries = false;
            foreach ($post_series as $ps) {
                if (pmpro_has_membership_access($ps)) {
                    $inseries = $ps;
                    break;
                }
            }
            if ($inseries) {
                //user has one of the series levels, find out which one and tell him how many days left
                $series = new PMProSeries($inseries);
                $day = $series->getDelayForPost($post->ID);
                $member_days = pmpro_getMemberDays($current_user->ID);
                $days_left = ceil($day - $member_days);
                $date = date(get_option("date_format"), strtotime("+ {$days_left} Days", current_time("timestamp")));
                $text = "This content is part of the <a href='" . get_permalink($inseries) . "'>" . get_the_title($inseries) . "</a> series. You will gain access on " . $date . ".";
            } else {
                //user has to sign up for one of the series
                if (count($post_series) == 1) {
                    $text = "This content is part of the <a href='" . get_permalink($post_series[0]) . "'>" . get_the_title($post_series[0]) . "</a> series.";
                } else {
                    $text = "This content is part of the following series: ";
                    $series = array();
                    foreach ($post_series as $series_id) {
                        $series[] = "<a href='" . get_permalink($series_id) . "'>" . get_the_title($series_id) . "</a>";
                    }
                    $text .= implode(", ", $series) . ".";
                }
            }
        }
    }
    return $text;
}
开发者ID:greathmaster,项目名称:pmpro-series,代码行数:39,代码来源:pmpro-series.php

示例15: paidmembershippro_builder_show_on_front

 /**
  * Builder integration with Paid Mambership Pro
  * Display the Builder contents only if user has permission to view the post contents
  *
  * @since 1.2.0
  * @return string $content
  */
 function paidmembershippro_builder_show_on_front($content)
 {
     global $ThemifyBuilder;
     $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) {
         $content = $ThemifyBuilder->builder_show_on_front($content);
     }
     return $content;
 }
开发者ID:byronmisiva,项目名称:mrkpln-dev,代码行数:22,代码来源:class-themify-builder-plugin-compat.php


注:本文中的pmpro_has_membership_access函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。