} ?> <?php do_action('rcp_after_register_form_fields'); ?> <?php if ($level->price > '0') { ?> <div class="rcp_gateway_fields"> <?php $gateways = rcp_get_enabled_payment_gateways(); if (count($gateways) > 1) { $display = rcp_has_paid_levels() ? '' : ' style="display: none;"'; ?> <fieldset class="rcp_gateways_fieldset"> <p id="rcp_payment_gateways"<?php echo $display; ?> > <select name="rcp_gateway" id="rcp_gateway"> <?php foreach ($gateways as $key => $gateway) { $recurring = rcp_gateway_supports($key, 'recurring') ? 'yes' : 'no'; ?> <option value="<?php echo esc_attr($key); ?> " data-supports-recurring="<?php
<span class="rcp_discount_valid" style="display: none;"> - <?php _e( 'Valid', 'rcp' ); ?></span> <span class="rcp_discount_invalid" style="display: none;"> - <?php _e( 'Invalid', 'rcp' ); ?></span> </label> <input type="text" id="rcp_discount_code" name="rcp_discount" class="rcp_discount_code" value=""/> </p> </fieldset> <?php endif; ?> <?php do_action( 'rcp_after_register_form_fields' ); ?> <?php if( $level->price > '0' ) : ?> <div class="rcp_gateway_fields"> <?php $gateways = rcp_get_enabled_payment_gateways(); if( count( $gateways ) > 1 ) : $display = rcp_has_paid_levels() ? '' : ' style="display: none;"'; ?> <fieldset class="rcp_gateways_fieldset"> <p id="rcp_payment_gateways"<?php echo $display; ?>> <select name="rcp_gateway" id="rcp_gateway"> <?php foreach( $gateways as $key => $gateway ) : $recurring = rcp_gateway_supports( $key, 'recurring' ) ? 'yes' : 'no'; ?> <option value="<?php echo esc_attr( $key ); ?>" data-supports-recurring="<?php echo esc_attr( $recurring ); ?>"><?php echo esc_html( $gateway ); ?></option> <?php endforeach; ?> </select> <label for="rcp_gateway"><?php _e( 'Choose Your Payment Method', 'rcp' ); ?></label> </p> </fieldset> <?php else: ?> <?php foreach( $gateways as $key => $gateway ) : $recurring = rcp_gateway_supports( $key, 'recurring' ) ? 'yes' : 'no'; ?> <input type="hidden" name="rcp_gateway" value="<?php echo esc_attr( $key ); ?>" data-supports-recurring="<?php echo esc_attr( $recurring ); ?>"/> <?php endforeach; ?> <?php endif; ?>
/** * 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 ); }
function after_register() { $_GET['level'] = get_usermeta($_GET['id'], 'reg_type'); $levels = rcp_get_subscription_levels('active'); $gateways = rcp_get_enabled_payment_gateways(); rcp_show_error_messages('register'); ?> <form id="rcp_registration_form" class="rcp_form" method="POST" action="<?php echo esc_url(rcp_get_current_url()); if (isset($_GET['id'])) { echo '?id=' . $_GET['id']; } ?> "> <div class="saloginwrapper"> <h2 class="section-title"><span>Successful Registration!</span></h2> <div class="clear"></div> <ul id="rcp_subscription_levels" style="display:none;"> <?php foreach ($levels as $key => $level) { ?> <?php if (rcp_show_subscription_level($level->id)) { ?> <li id="rcp_subscription_level_<?php echo $level->id; ?> " class="rcp_subscription_level"> <input type="radio" class="required rcp_level" <?php if (isset($_GET['level']) && $_GET['level'] == $level->id) { echo 'checked="checked"'; } ?> name="rcp_level" rel="<?php echo esc_attr($level->price); ?> " value="<?php echo esc_attr(absint($level->id)); ?> " <?php if ($level->duration == 0) { echo 'data-duration="forever"'; } ?> /> <span class="rcp_subscription_level_name"><?php echo rcp_get_subscription_name($level->id); ?> </span><span class="rcp_separator"> - </span><span class="rcp_price" rel="<?php echo esc_attr($level->price); ?> "><?php echo $level->price > 0 ? rcp_currency_filter($level->price) : __('free', 'rcp'); ?> <span class="rcp_separator"> - </span></span> <span class="rcp_level_duration"><?php echo $level->duration > 0 ? $level->duration . ' ' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'rcp'); ?> </span> <div class="rcp_level_description"> <?php echo rcp_get_subscription_description($level->id); ?> </div> </li> <?php } ?> <?php } ?> </ul> <?php $gateways = rcp_get_enabled_payment_gateways(); if (count($gateways) > 1) { $display = rcp_has_paid_levels() ? '' : ' style="display: none;"'; ?> <fieldset class="rcp_gateways_fieldset"> <p> <label><?php _e('Choose Your Payment Method', 'rcp'); ?> </label> </p> <p id="rcp_payment_gateways"<?php echo $display; ?> > <select name="rcp_gateway" id="rcp_gateway" style="float:left; position:relative;"> <?php foreach ($gateways as $key => $gateway) { ?> <option value="<?php echo esc_attr($key); ?> "><?php echo esc_html($gateway); ?> </option> <?php } ?> </select> </p> </fieldset> <?php } ?> <?php do_action('rcp_before_registration_submit_field', $levels); ?> <p id="rcp_submit_wrap"> <input type="hidden" name="rcp_register_nonce" value="<?php echo wp_create_nonce('rcp-register-nonce'); ?> "/> <input type="submit" name="rcp_submit_registration" id="rcp_submit" value="<?php echo apply_filters('rcp_registration_register_button', __('Register', 'rcp')); ?> "/> </p> <div class="clear"></div> </div></form> <?php }