本文整理匯總了PHP中rcp_is_active函數的典型用法代碼示例。如果您正苦於以下問題:PHP rcp_is_active函數的具體用法?PHP rcp_is_active怎麽用?PHP rcp_is_active使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了rcp_is_active函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: pw_rcp_redirect_blog
function pw_rcp_redirect_blog()
{
if (is_home() && !rcp_is_active()) {
wp_redirect(home_url('/'));
exit;
}
}
示例2: rcp_stripe_checkout_shortcode
function rcp_stripe_checkout_shortcode($atts)
{
global $rcp_options;
if (isset($rcp_options['sandbox'])) {
$key = $rcp_options['stripe_test_publishable'];
} else {
$key = $rcp_options['stripe_live_publishable'];
}
$atts = shortcode_atts(array('plan_id' => 0, 'price' => 0), $atts);
$user_id = get_current_user_id();
$user = get_userdata($user_id);
$is_active = rcp_is_active($user_id);
$subscription = rcp_get_subscription_details($atts['plan_id']);
$price = $subscription->price * 100;
?>
<form action="" method="post">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<?php
echo $key;
?>
"
data-name="CG Cookie"
data-image="https://s3.amazonaws.com/cgcookie/cgc_logo_128.png"
data-description="Join Citizen ($<?php
echo $price / 100;
?>
per month)"
data-label="Join <?php
echo $subscription->name;
?>
"
data-amount="<?php
echo $price;
?>
"
data-locale="auto"
data-email="<?php
echo $user->user_email;
?>
"
data-allow-remember-me="true"
>
</script>
<input type="hidden" name="subscription_id" value="<?php
echo $subscription->id;
?>
" />
<input type="hidden" name="price" value="<?php
echo $price;
?>
" />
<input type="hidden" name="source" value="stripe-checkout" />
</form>
<?php
}
示例3: rcp_hide_premium_posts
function rcp_hide_premium_posts($query)
{
global $rcp_options, $user_ID;
$suppress_filters = isset($query->query_vars['suppress_filters']);
if (isset($rcp_options['hide_premium']) && !is_singular() && false == $suppress_filters) {
if (!rcp_is_active($user_ID)) {
$premium_ids = rcp_get_paid_posts();
if ($premium_ids) {
$query->set('post__not_in', $premium_ids);
}
}
}
}
示例4: rcp_redirect_from_premium_post
function rcp_redirect_from_premium_post() {
global $rcp_options, $user_ID, $post;
if( isset($rcp_options['hide_premium'] ) && $rcp_options['hide_premium'] ) {
if( !rcp_is_active( $user_ID ) && is_singular() && rcp_is_paid_content( $post->ID ) ) {
if( isset( $rcp_options['redirect_from_premium'] ) ) {
$redirect = get_permalink( $rcp_options['redirect_from_premium'] );
} else {
$redirect = home_url();
}
wp_redirect( $redirect ); exit;
}
}
}
示例5: add_to_context
function add_to_context($context)
{
$context['notes'] = 'These values are available everytime you call Timber::get_context();';
$context['menu'] = new TimberMenu();
$context['site'] = $this;
// Site-wide Settings
$context['site_callout_bool'] = get_field('site_callout_bool', 'options');
$context['site_callout_text'] = get_field('site_callout_text', 'options');
$context['site_footer_copyright'] = get_field('site_footer_copyright', 'options');
$context['site_footer_credits'] = get_field('site_footer_credits', 'options');
// Restrict content pro shortcuts
$context['registration_page'] = get_page_by_title('Register');
$context['access'] = rcp_is_active();
return $context;
}
示例6: rcp_show_user_columns
function rcp_show_user_columns($value, $column_name, $user_id)
{
if ('rcp_status' == $column_name) {
return rcp_get_status($user_id);
}
if ('rcp_subscription' == $column_name) {
return rcp_get_subscription($user_id);
}
if ('rcp_links' == $column_name) {
$page = admin_url('/admin.php?page=rcp-members');
if (rcp_is_active($user_id)) {
$links = '<a href="' . esc_url($page) . '&edit_member=' . esc_attr(absint($user_id)) . '">' . __('Edit Subscription', 'rcp') . '</a>';
} else {
$links = '<a href="' . esc_url($page) . '&edit_member=' . esc_attr(absint($user_id)) . '">' . __('Add Subscription', 'rcp') . '</a>';
}
return $links;
}
return $value;
}
示例7: rcp_get_subscription
</td>
<td><?php
echo rcp_get_subscription();
?>
</td>
<td><?php
echo rcp_get_expiration_date();
?>
</td>
<td>
<?php
if ((rcp_is_expired($user_ID) || !rcp_is_recurring($user_ID) || rcp_get_status($user_ID) == 'cancelled') && rcp_subscription_upgrade_possible($user_ID)) {
echo '<a href="' . esc_url(get_permalink($rcp_options['registration_page'])) . '" title="' . __('Renew your subscription', 'rcp') . '" class="rcp_sub_details_renew">' . __('Renew your subscription', 'rcp') . '</a>';
} elseif (!rcp_is_active($user_ID) && rcp_subscription_upgrade_possible($user_ID)) {
echo '<a href="' . esc_url(get_permalink($rcp_options['registration_page'])) . '" title="' . __('Upgrade your subscription', 'rcp') . '" class="rcp_sub_details_renew">' . __('Upgrade your subscription', 'rcp') . '</a>';
} elseif (rcp_is_active($user_ID) && rcp_is_paypal_subscriber()) {
echo '<a href="https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_manage-paylist" target="_blank" title="' . __('Cancel your subscription', 'rcp') . '">' . __('Cancel your subscription', 'rcp') . '</a>';
}
do_action('rcp_subscription_details_action_links');
?>
</td>
</tr>
</tbody>
</table>
<table class="rcp-table" id="rcp-payment-history">
<thead>
<tr>
<th><?php
_e('Invoice #', 'rcp');
?>
</th>
示例8: rcp_registration_form
function rcp_registration_form( $atts, $content = null ) {
extract( shortcode_atts( array(
'id' => null,
'registered_message' => __( 'You are already registered and have an active subscription.', 'rcp' )
), $atts ) );
global $user_ID;
// only show the registration form to non-logged-in members
if( ! rcp_is_active( $user_ID ) || rcp_is_trialing( $user_ID ) || rcp_subscription_upgrade_possible( $user_ID ) ) {
global $rcp_options, $rcp_load_css, $rcp_load_scripts;
// set this to true so the CSS and JS scripts are loaded
$rcp_load_css = true;
$rcp_load_scripts = true;
$output = rcp_registration_form_fields( $id );
} else {
$output = $registered_message;
}
return $output;
}
示例9: is_visible
/**
* Restrict the visibility of a product
*
* @access public
* @since 2.2
*/
public function is_visible($ret, $product_id)
{
if ($ret) {
$has_access = true;
$active_only = get_post_meta($product_id, '_rcp_woo_active_to_view', true);
$levels = (array) get_post_meta($product_id, '_rcp_woo_subscription_levels_to_view', true);
$access_level = get_post_meta($product_id, '_rcp_woo_access_level_to_view', true);
if ($active_only) {
if (!rcp_is_active()) {
$has_access = false;
}
}
if (is_array($levels) && !empty($array[0])) {
if (!in_array(rcp_get_subscription_id(), $levels)) {
$has_access = false;
}
}
if ($access_level) {
if (!rcp_user_has_access(get_current_user_id(), $access_level)) {
$has_access = false;
}
}
$ret = $has_access;
}
return $ret;
}
示例10: renew
/**
* Renews a member's membership by updating status and expiration date
*
* Does NOT handle payment processing for the renewal. This should be called after receiving a renewal payment
*
* @access public
* @since 2.1
*/
public function renew($recurring = false, $status = 'active')
{
if (!$this->get_subscription_id()) {
return false;
}
// Get the member's current expiration date
$expires = $this->get_expiration_time();
// Determine what date to use as the start for the new expiration calculation
if ($expires > current_time('timestamp') && rcp_is_active($this->ID)) {
$base_date = $expires;
} else {
$base_date = current_time('timestamp');
}
$subscription = rcp_get_subscription_details($this->get_subscription_id());
if ($subscription->duration > 0) {
$last_day = cal_days_in_month(CAL_GREGORIAN, date('n', $base_date), date('Y', $base_date));
$expiration = date('Y-m-d H:i:s', strtotime('+' . $subscription->duration . ' ' . $subscription->duration_unit . ' 23:59:59'));
if (date('j', $base_date) == $last_day && 'day' != $subscription->duration_unit) {
$expiration = date('Y-m-d H:i:s', strtotime($expiration . ' +2 days'));
}
} else {
$expiration = 'none';
}
$expiration = apply_filters('rcp_member_renewal_expiration', $expiration, $subscription, $this->ID);
do_action('rcp_member_pre_renew', $this->ID, $expiration, $this);
$this->set_status($status);
$this->set_expiration_date($expiration);
$this->set_recurring($recurring);
delete_user_meta($this->ID, '_rcp_expired_email_sent');
do_action('rcp_member_post_renew', $this->ID, $expiration, $this);
}
示例11: rcp_subscription_upgrade_possible
/**
* Determine if it's possible to upgrade a user's subscription
*
* @since v1.5
* @access public
* @param $user_id INT the ID of the user to check
* @return bool
*/
function rcp_subscription_upgrade_possible( $user_id = 0 ) {
if( empty( $user_id ) )
$user_id = get_current_user_id();
$ret = false;
if( ( ! rcp_is_active( $user_id ) || ! rcp_is_recurring( $user_id ) ) && rcp_has_paid_levels() )
$ret = true;
return (bool) apply_filters( 'rcp_can_upgrade_subscription', $ret, $user_id );
}
示例12: user_can_post
/**
* Can the current user post jobs?
*
* @access public
* @since 1.0
* @return bool
*/
public function user_can_post()
{
return rcp_is_active() && !$this->is_at_jobs_limit();
}
示例13: rcp_process_registration
//.........這裏部分代碼省略.........
}
// only create the user if there are no errors
if( ! empty( $errors ) ) {
return;
}
// deterime the expiration date of the user's subscription
if( $expiration->duration > 0 ) {
$member_expires = rcp_calc_member_expiration( $expiration );
} else {
$member_expires = 'none';
}
if( $user_data['need_new'] ) {
$user_data['id'] = wp_insert_user( array(
'user_login' => $user_data['login'],
'user_pass' => $user_data['password'],
'user_email' => $user_data['email'],
'first_name' => $user_data['first_name'],
'last_name' => $user_data['last_name'],
'user_registered' => date( 'Y-m-d H:i:s' )
)
);
}
if( $user_data['id'] ) {
if( ! rcp_is_active( $user_data['id'] ) ) {
rcp_set_status( $user_data['id'], 'pending' );
}
// setup a unique key for this subscription
$subscription_key = rcp_generate_subscription_key();
update_user_meta( $user_data['id'], 'rcp_subscription_key', $subscription_key );
update_user_meta( $user_data['id'], 'rcp_subscription_level', $subscription_id );
rcp_set_expiration_date( $user_data['id'], $member_expires );
// Set the user's role
$role = ! empty( $subscription->role ) ? $subscription->role : 'subscriber';
$user = new WP_User( $user_data['id'] );
$user->add_role( apply_filters( 'rcp_default_user_level', $role, $subscription_id ) );
do_action( 'rcp_form_processing', $_POST, $user_data['id'], $price );
// process a paid subscription
if( $price > '0' ) {
if( ! empty( $discount ) ) {
// record the usage of this discount code
$discounts->add_to_user( $user_data['id'], $discount );
// incrase the usage count for the code
$discounts->increase_uses( $discount_obj->id );
// if the discount is 100%, log the user in and redirect to success page
if( $price == '0' ) {
示例14:
<?php
//RCP SUBSCRIBE & LOGIN BUTTONS
if (is_plugin_active('restrict-content-pro/restrict-content-pro.php')) {
global $user_ID;
if (!rcp_is_active($user_ID)) {
?>
<div class="rcp-access-btns">
<?php
if (get_theme_mod('register_page_selector')) {
?>
<a class="btn rcp-subscribe" href="<?php
echo get_page_link(get_theme_mod('register_page_selector'));
?>
"><?php
_e('Subscribe Today', 'bean');
?>
</a>
<?php
}
?>
<?php
if (get_theme_mod('login_page_selector')) {
?>
<a class="btn rcp-login" href="<?php
echo get_page_link(get_theme_mod('login_page_selector'));
?>
"><?php
_e('Login', 'bean');
?>
</a>
示例15: do_action
);
?>
</p>
<?php do_action( 'woocommerce_before_my_account' ); ?>
<?php wc_get_template( 'myaccount/form-edit-account.php', array( 'user' => $current_user ) ); ?>
<?php wc_get_template( 'myaccount/my-downloads.php' ); ?>
<?php wc_get_template( 'myaccount/my-orders.php', array( 'order_count' => $order_count ) ); ?>
<?php if( rcp_is_active() ) :
echo "<legend>Mes packs VOD</legend>";
if (can_access($post_id = 7293)) :
echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-premium/' class='not-btn more-link' > Pack premium </a ><br />";
elseif (can_access($post_id = 7292)) :
echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-poids-de-corps/' class='not-btn more-link' > Pack poids du corps </a ><br />";
elseif (can_access($post_id = 6762)) :
echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-haut-du-corps/' class='not-btn more-link' > Pack haut du corps </a ><br />";
elseif (can_access($post_id = 6760)) :
echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-bas-du-corps/' class='not-btn more-link' > Pack bas du corps </a ><br />";
elseif (can_access($post_id = 5701)) :
echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-abdos-et-gainage/' class='not-btn more-link' > Pack abdos et gainage </a ><br />";
elseif (can_access($post_id = 7225)) :
echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-special-bras/' class='not-btn more-link' > Pack spécial bras </a ><br />";
elseif (can_access($post_id = 7294)) :
echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-strong-is-the-new-sexy/' class='not-btn more-link' > Pack strong is the new sexy </a ><br />";