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; }
function pw_rcp_redirect_blog() { if (is_home() && !rcp_is_active()) { wp_redirect(home_url('/')); exit; } }
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 }
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; } } }
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); } } } }
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; }
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; }
</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>
/** * 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); }
/** * 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(); }
/** * 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 ); }
/** * Register a new user * * @access public * @since 1.0 */ function rcp_process_registration() { if ( isset( $_POST["rcp_register_nonce"] ) && wp_verify_nonce( $_POST['rcp_register_nonce'], 'rcp-register-nonce' ) ) { global $rcp_options, $user_ID; $subscription_id = isset( $_POST['rcp_level'] ) ? absint( $_POST['rcp_level'] ) : false; $discount = isset( $_POST['rcp_discount'] ) ? sanitize_text_field( $_POST['rcp_discount'] ) : ''; $discount_valid = false; $price = number_format( (float) rcp_get_subscription_price( $subscription_id ), 2 ); $price = str_replace( ',', '', $price ); $base_price = $price; // Used for discount calculations later $expiration = rcp_get_subscription_length( $subscription_id ); $subscription = rcp_get_subscription_details( $subscription_id ); // get the selected payment method/gateway if( ! isset( $_POST['rcp_gateway'] ) ) { $gateway = 'paypal'; } else { $gateway = sanitize_text_field( $_POST['rcp_gateway'] ); } /*********************** * validate the form ***********************/ do_action( 'rcp_before_form_errors', $_POST ); $is_ajax = isset( $_POST['rcp_ajax'] ); $user_data = rcp_validate_user_data(); if( ! $subscription_id ) { // no subscription level was chosen rcp_errors()->add( 'no_level', __( 'Please choose a subscription level', 'rcp' ), 'register' ); } if( $subscription_id ) { if( $price == 0 && $expiration->duration > 0 && rcp_has_used_trial( $user_data['id'] ) ) { // this ensures that users only sign up for a free trial once rcp_errors()->add( 'free_trial_used', __( 'You may only sign up for a free trial once', 'rcp' ), 'register' ); } } if( ! empty( $discount ) ) { if( rcp_validate_discount( $discount, $subscription_id ) ) { $discount_valid = true; } else { // the entered discount code is incorrect rcp_errors()->add( 'invalid_discount', __( 'The discount you entered is invalid', 'rcp' ), 'register' ); } if( $discount_valid && $price > 0 ) { if( ! $user_data['need_new'] && rcp_user_has_used_discount( $user_data['id'] , $discount ) && apply_filters( 'rcp_discounts_once_per_user', true ) ) { $discount_valid = false; rcp_errors()->add( 'discount_already_used', __( 'You can only use the discount code once', 'rcp' ), 'register' ); } if( $discount_valid ) { $discounts = new RCP_Discounts(); $discount_obj = $discounts->get_by( 'code', $discount ); if( is_object( $discount_obj ) ) { // calculate the after-discount price $price = $discounts->calc_discounted_price( $base_price, $discount_obj->amount, $discount_obj->unit ); } } } } if( $price == 0 && isset( $_POST['rcp_auto_renew'] ) ) { // since free subscriptions do not go through PayPal, they cannot be auto renewed rcp_errors()->add( 'invalid_auto_renew', __( 'Free subscriptions cannot be automatically renewed', 'rcp' ), 'register' ); } // Validate extra fields in gateways with the 2.1+ gateway API if( ! has_action( 'rcp_gateway_' . $gateway ) && $price > 0 ) { $gateways = new RCP_Payment_Gateways; $gateway_var = $gateways->get_gateway( $gateway ); $gateway_obj = new $gateway_var['class']; $gateway_obj->validate_fields(); } do_action( 'rcp_form_errors', $_POST ); // retrieve all error messages, if any $errors = rcp_errors()->get_error_messages(); if ( ! empty( $errors ) && $is_ajax ) { wp_send_json_error( array( 'success' => false, 'errors' => rcp_get_error_messages_html( 'register' ), 'nonce' => wp_create_nonce( 'rcp-register-nonce' ) ) ); } elseif( $is_ajax ) { wp_send_json_success( array( 'success' => true ) ); } // 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' ) { rcp_set_status( $user_data['id'], 'active' ); rcp_email_subscription_status( $user_data['id'], 'active' ); rcp_login_user_in( $user_data['id'], $user_data['login'] ); wp_redirect( rcp_get_return_url( $user_data['id'] ) ); exit; } } // Determine auto renew behavior if( '3' == rcp_get_auto_renew_behavior() && isset( $_POST['rcp_auto_renew'] ) ) { $auto_renew = true; } elseif( '1' == rcp_get_auto_renew_behavior() ) { $auto_renew = true; } else { $auto_renew = false; } // Remove trialing status, if it exists delete_user_meta( $user_data['id'], 'rcp_is_trialing' ); // log the new user in rcp_login_user_in( $user_data['id'], $user_data['login'] ); $redirect = rcp_get_return_url( $user_data['id'] ); $subscription_data = array( 'price' => $price, 'discount' => $base_price - $price, 'discount_code' => $discount, 'fee' => ! empty( $subscription->fee ) ? number_format( $subscription->fee, 2 ) : 0, 'length' => $expiration->duration, 'length_unit' => strtolower( $expiration->duration_unit ), 'subscription_id' => $subscription->id, 'subscription_name' => $subscription->name, 'key' => $subscription_key, 'user_id' => $user_data['id'], 'user_name' => $user_data['login'], 'user_email' => $user_data['email'], 'currency' => $rcp_options['currency'], 'auto_renew' => $auto_renew, 'return_url' => $redirect, 'new_user' => $user_data['need_new'], 'post_data' => $_POST ); // send all of the subscription data off for processing by the gateway rcp_send_to_gateway( $gateway, apply_filters( 'rcp_subscription_data', $subscription_data ) ); // process a free or trial subscription } else { // This is a free user registration or trial // if the subscription is a free trial, we need to record it in the user meta if( $member_expires != 'none' ) { // this is so that users can only sign up for one trial update_user_meta( $user_data['id'], 'rcp_has_trialed', 'yes' ); update_user_meta( $user_data['id'], 'rcp_is_trialing', 'yes' ); // activate the user's trial subscription rcp_set_status( $user_data['id'], 'active' ); rcp_email_subscription_status( $user_data['id'], 'trial' ); } else { // set the user's status to free rcp_set_status( $user_data['id'], 'free' ); rcp_email_subscription_status( $user_data['id'], 'free' ); } // date for trial / paid users, "none" for free users rcp_set_expiration_date( $user_data['id'], $member_expires ); if( $user_data['need_new'] ) { if( ! isset( $rcp_options['disable_new_user_notices'] ) ) { // send an email to the admin alerting them of the registration wp_new_user_notification( $user_data['id']) ; } // log the new user in rcp_login_user_in( $user_data['id'], $user_data['login'] ); } // send the newly created user to the redirect page after logging them in wp_redirect( rcp_get_return_url( $user_data['id'] ) ); exit; } // end price check } // end if new user id } // end nonce check }
<?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>
/** * Add priority support status to users * * @since 1.0.0 * @return void */ function wi_bbp_add_user_priority_support_status() { if (!current_user_can('moderate')) { return; } elseif (!function_exists('rcp_get_status')) { return; } $user_id = bbp_get_displayed_user_field('ID'); echo '<div class="rcp_support_status">'; echo '<h4>Priority Support Access</h4>'; if (rcp_is_active($user_id)) { echo '<p>Has <strong>Priority Support</strong> access.</p>'; } elseif (rcp_is_expired($user_id)) { echo '<p><strong>Priority Support</strong> access has <span style="color:red;">expired</span>.</p>'; } else { echo '<p>Has no priority support accesss</p>'; } echo '</div>'; }
/** * Loads the restricted content template if required. * * @access public * @since 2.5 */ public function hide_template($template, $slug, $name) { $product_id = get_the_ID(); if (!is_singular('product')) { return $template; } if ('content-single-product' !== $slug . '-' . $name) { return $template; } if (current_user_can('edit_post', $product_id)) { return $template; } $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); $product_cat = rcp_is_post_taxonomy_restricted($product_id, 'product_cat'); $product_tag = rcp_is_post_taxonomy_restricted($product_id, 'product_tag'); /** * rcp_is_post_taxonomy_restricted() returns: * - true when restrictions are found for the current user * - false when restrictions are not found for the current user * - -1 when no terms are assigned, for which we don't care. * We're normalizing the value here. If the value is false, * the user has already passed the restriction checks. */ $cat_restricted = true === $product_cat ? true : false; $tag_restricted = true === $product_tag ? true : false; // Return early if no restrictions if (!$active_only && empty($levels[0]) && !$access_level && !$cat_restricted && !$tag_restricted) { return $template; } $visible = true; // Active subscription setting if ($active_only && !rcp_is_active()) { $visible = false; } // Subscription level setting if (!in_array(rcp_get_subscription_id(), $levels)) { $visible = false; } // User level setting if ($access_level && rcp_user_has_access(get_current_user_id(), $access_level)) { $visible = false; } if ($visible) { return $template; } return rcp_get_template_part('woocommerce', 'single-no-access', false); }
); ?> </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 />";
/** * 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; }
/** * EDD Forum Sidebar * * @since 1.0.0 * @return void */ function edd_bbp_sidebar() { global $post; $user_id = get_the_author_meta('ID'); $user_data = get_userdata($user_id); ?> <div class="box"> <?php do_action('edd_bbp_sidebar'); ?> <h3><?php echo get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name'); ?> </h3> <p class="bbp-user-forum-role"><?php printf('Forum Role: %s', bbp_get_user_display_role($user_id)); ?> </p> <p class="bbp-user-topic-count"><?php printf('Topics Started: %s', bbp_get_user_topic_count_raw($user_id)); ?> </p> <p class="bbp-user-reply-count"><?php printf('Replies Created: %s', bbp_get_user_reply_count_raw($user_id)); ?> </p> <div class="rcp_support_status"> <h4>Priority Support Access</h4> <?php if (function_exists('rcp_is_active')) { if (rcp_is_active($user_id)) { ?> <p>Has <strong>Priority Support</strong> access.</p> <?php } elseif (rcp_is_expired($user_id)) { ?> <p><strong>Priority Support</strong> access has <span style="color:red;">expired</span>.</p> <?php } else { ?> <p>Has no priority support accesss</p> <?php } } ?> </div><!-- /.rcp_support_status --> <div class="edd_users_purchases"> <h4>User's Purchases:</h4> <?php $purchases = edd_get_users_purchases($user_data->user_email, 100, false, 'any'); if ($purchases) { echo '<ul>'; foreach ($purchases as $purchase) { echo '<li>'; echo '<strong><a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $purchase->ID) . '">#' . $purchase->ID . ' - ' . edd_get_payment_status($purchase, true) . '</a></strong><br/>'; $downloads = edd_get_payment_meta_downloads($purchase->ID); foreach ($downloads as $download) { echo get_the_title($download['id']) . ' - ' . date('F j, Y', strtotime($purchase->post_date)) . '<br/>'; } if (function_exists('edd_software_licensing')) { $licenses = edd_software_licensing()->get_licenses_of_purchase($purchase->ID); if ($licenses) { echo '<strong>Licenses:</strong><br/>'; foreach ($licenses as $license) { $key = edd_software_licensing()->get_license_key($license->ID); echo '<a href="' . admin_url('edit.php?post_type=download&page=edd-licenses&s=' . $key) . '">' . $key . '</a>'; echo ' - ' . edd_software_licensing()->get_license_status($license->ID); echo '<br/>'; } } echo '<hr/>'; } echo '</li>'; } echo '</ul>'; } else { echo '<p>This user has never purchased anything.</p>'; } ?> </div> </div> <?php }
</div> <?php } ?> <?php pp_post_footer(); ?> <?php } ?> <?php // Upsell non-members to premium content if (has_category('subscriber-only') && is_singular() && !rcp_is_active()) { ?> <a href="<?php echo site_url('join-the-site'); ?> " class="upsell"> <div class="box columns columns-2"> <div class="col"> <p>Join now to gain access to this tutorial and more.</p> </div> <div class="col align-right"> <span class="button">Join Now</span> </div>
/** * Get subscriptions to which this user can upgrade * * @since 2.5 * @param int $user_id the ID of the user to check * * @return mixed|void */ function rcp_get_upgrade_paths($user_id = 0) { if (empty($user_id)) { $user_id = get_current_user_id(); } // make sure the user is active and get the subscription ID $user_subscription = rcp_is_recurring($user_id) && rcp_is_active($user_id) && 'cancelled' !== rcp_get_status() ? rcp_get_subscription_id($user_id) : ''; $subscriptions = rcp_get_subscription_levels('active'); // remove the user's current subscription from the list foreach ($subscriptions as $key => $subscription) { if ($user_subscription == $subscription->id) { unset($subscriptions[$key]); } } return apply_filters('rcp_get_upgrade_paths', array_values($subscriptions), $user_id); }
<?php endif; ?> <th><?php _e( 'Actions', 'rcp' ); ?></th> </tr> </thead> <tbody> <tr> <td><?php rcp_print_status(); ?></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_can_member_cancel( $user_ID ) ) { echo '<a href="' . rcp_get_member_cancel_url( $user_ID ) . '" 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> <th><?php _e( 'Subscription', 'rcp' ); ?></th> <th><?php _e( 'Payment Method', 'rcp' ); ?></th> <th><?php _e( 'Amount', 'rcp' ); ?></th>
<?php /** * Template name: List * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages * and that other 'pages' on your WordPress site will use a * different template. * * @package Primemovers */ get_header('secure'); if (rcp_is_active()) { while (have_posts()) { the_post(); ?> <div class="full-section secure-page"> <div class="group"> <?php //get_sidebar(); ?> <article class="entry-content group list-content"> <header class="secure-page-header"> <h1><?php the_title(); ?> </h1> <p class="disclaimer">This directory was created for Primemovers Alumni use only and with the permission of those who wish to be included. Please respect the privacy of others and refrain from sharing this information outside of the Primemovers community.</p> <!-- <p><?php
/** * Apply the discounts to the cart * * @since 1.0 * * @access public * @return void */ public function apply_discounts($download_id, $options) { if (!function_exists('rcp_is_active')) { return; } $user_id = get_current_user_id(); if (!rcp_is_active($user_id)) { return; } $sub_id = rcp_get_subscription_id($user_id); if (!$sub_id) { $this->clear_cart_discounts(); return; } // Check for member discounts $discounts = get_posts(array('post_type' => 'edd_rcp_discount', 'posts_per_page' => '1', 'fields' => 'ids', 'meta_query' => array('relation' => 'AND', array('key' => '_edd_rcp_discount_subscription', 'value' => $sub_id)))); if (!$discounts) { $this->clear_cart_discounts(); return; } // Get cart details $cart_amount = edd_get_cart_subtotal(); $cart_details = edd_get_cart_content_details(); if (empty($cart_details)) { $this->clear_cart_discounts(); return; } // Subtract exclusions from the cart amount before calculating the discount below. foreach ($cart_details as $key => $download) { // Check for product-level exclusion if (get_post_meta($download['id'], 'rcp_member_discount_exclude')) { $cart_amount -= $download['item_price']; continue; } // Check for download category exclusions $terms = wp_get_object_terms($download['id'], 'download_category'); if (!$terms) { continue; } $term_discounted = false; foreach ($terms as $term) { if (!$term_discounted && get_term_meta($term->term_id, 'rcp_member_discount_exclude')) { $cart_amount -= $download['item_price']; $term_discounted = true; continue; } } } // If the cart amount is 0 after subtracting exclusions, no member discount is applied. if ('0' == $cart_amount) { $this->clear_cart_discounts(); return; } foreach ($discounts as $discount) { $percent = get_post_meta($discount, '_edd_rcp_discount_amount', true); $amount = $cart_amount * ($percent / 100) * -1; EDD()->fees->add_fee(array('amount' => $amount, 'label' => get_the_title($discount), 'id' => 'rcp_member_discount')); EDD()->session->set('rcp_member_discount_id', $discount); } }