public function process_signup()
 {
     global $rcp_options;
     $user_id = get_current_user_id();
     $user_data = get_userdata($user_id);
     if (empty($_POST['stripeToken'])) {
         wp_die('Missing Stripe token, please try again or contact support if the issue persists.');
     }
     $token = $_POST['stripeToken'];
     $email = $_POST['stripeEmail'];
     $plan_id = $_POST['subscription_id'];
     $subscription = rcp_get_subscription_details($plan_id);
     $price = $subscription->price;
     $base_price = $price;
     $discount = isset($_POST['rcp_discount']) ? sanitize_text_field($_POST['rcp_discount']) : '';
     $discount_valid = false;
     $expiration = rcp_get_subscription_length($plan_id);
     $currency = strtolower($rcp_options['currency']);
     $redirect = rcp_get_current_url();
     $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' => '', 'user_id' => $user_data->id, 'user_name' => $user_data->user_login, 'user_email' => $user_data->user_email, 'currency' => $rcp_options['currency'], 'auto_renew' => true, 'return_url' => $redirect, 'new_user' => false, 'post_data' => $_POST);
     // Update the user's plan
     update_user_meta($user_id, 'rcp_subscription_level', $plan_id);
     // send all of the subscription data off for processing by the gateway
     rcp_send_to_gateway('stripe', apply_filters('rcp_subscription_data', $subscription_data));
 }
function rcp_change_password_form($args = array())
{
    global $rcp_password_form_args;
    // parse the arguments passed
    $defaults = array('redirect' => rcp_get_current_url());
    $rcp_password_form_args = wp_parse_args($args, $defaults);
    ob_start();
    do_action('rcp_before_password_form');
    rcp_get_template_part('change-password');
    do_action('rcp_after_password_form');
    return ob_get_clean();
}
<?php 
} else {
    ?>
	<h3 class="rcp_header">
		<?php 
    echo apply_filters('rcp_registration_header_logged_out', __('Upgrade Your Subscription', 'rcp'));
    ?>
	</h3>
<?php 
}
// show any error messages after form submission
rcp_show_error_messages('register');
?>

<form id="rcp_registration_form" class="rcp_form" method="POST" action="<?php 
echo esc_url(rcp_get_current_url());
?>
">

	<div class="rcp_description"><?php 
echo wpautop(wptexturize(rcp_get_subscription_description($rcp_level)));
?>
</div>

	<?php 
if (!is_user_logged_in()) {
    ?>

	<?php 
    do_action('rcp_before_register_form_fields');
    ?>
/**
 * Process a member cancellation request
 *
 * @access      public
 * @since       2.1
 */
function rcp_process_member_cancellation() {

	if( ! isset( $_GET['rcp-action'] ) || $_GET['rcp-action'] !== 'cancel' ) {
		return;
	}

	if( ! is_user_logged_in() ) {
		return;
	}

	if( wp_verify_nonce( $_GET['_wpnonce'], 'rcp-cancel-nonce' ) ) {

		global $rcp_options;

		$success  = rcp_cancel_member_payment_profile( get_current_user_id() );
		$redirect = remove_query_arg( array( 'rcp-action', '_wpnonce', 'member-id' ), rcp_get_current_url() );

		if( ! $success && rcp_is_paypal_subscriber() ) {
			// No profile ID stored, so redirect to PayPal to cancel manually
			$redirect = 'https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_manage-paylist';
		}

		if( $success ) {

			do_action( 'rcp_process_member_cancellation', get_current_user_id() );

			$redirect = add_query_arg( 'profile', 'cancelled', $redirect );

		}
	
		wp_redirect( $redirect ); exit;

	}
}
<?php $level = rcp_get_subscription_details( $rcp_level ); ?>

<?php if( ! is_user_logged_in() ) { ?>
	<h3 class="rcp_header">
		<?php echo apply_filters( 'rcp_registration_header_logged_in', __( 'Register New Account', 'rcp' ) ); ?>
	</h3>
<?php } else { ?>
	<h3 class="rcp_header">
		<?php echo apply_filters( 'rcp_registration_header_logged_out', __( 'Upgrade Your Subscription', 'rcp' ) ); ?>
	</h3>
<?php }

// show any error messages after form submission
rcp_show_error_messages( 'register' ); ?>

<form id="rcp_registration_form" class="rcp_form" method="POST" action="<?php echo esc_url( rcp_get_current_url() ); ?>">

	<div class="rcp_description"><?php echo wpautop( wptexturize( rcp_get_subscription_description( $rcp_level ) ) ); ?></div>
	
	<?php if( ! is_user_logged_in() ) { ?>

	<?php do_action( 'rcp_before_register_form_fields' ); ?>


	<fieldset class="rcp_user_fieldset">
		<p id="rcp_user_login_wrap">
			<label for="rcp_user_Login"><?php echo apply_filters ( 'rcp_registration_username_label', __( 'Username', 'rcp' ) ); ?></label>
			<input name="rcp_user_login" id="rcp_user_login" class="required" type="text" <?php if( isset( $_POST['rcp_user_login'] ) ) { echo 'value="' . esc_attr( $_POST['rcp_user_login'] ) . '"'; } ?>/>
		</p>
		<p id="rcp_user_email_wrap">
			<label for="rcp_user_email"><?php echo apply_filters ( 'rcp_registration_email_label', __( 'Email', 'rcp' ) ); ?></label>
function rcp_login_form( $atts, $content = null ) {

	global $post;

	$current_page = rcp_get_current_url();

	extract( shortcode_atts( array(
		'redirect' 	=> $current_page,
		'class' 	=> 'rcp_form'
	), $atts ) );

	$output = '';

	global $rcp_load_css;

	// set this to true so the CSS is loaded
	$rcp_load_css = true;

	$output = rcp_login_form_fields( array( 'redirect' => $redirect, 'class' => $class ) );

	return $output;
}
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"';
            }
            ?>
/>&nbsp;
					<span class="rcp_subscription_level_name"><?php 
            echo rcp_get_subscription_name($level->id);
            ?>
</span><span class="rcp_separator">&nbsp;-&nbsp;</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">&nbsp;-&nbsp;</span></span>
					<span class="rcp_level_duration"><?php 
            echo $level->duration > 0 ? $level->duration . '&nbsp;' . 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 
}
		<fieldset class="grid rcp_login_data">
			<p class="unit one-of-two">
				<input name="rcp_user_login" id="rcp_user_login" class="required" type="text"/>
				<label for="rcp_user_Login"><?php 
    _e('Username', 'rcp');
    ?>
</label>
			</p>
			<p class="unit one-of-two">
				<input name="rcp_user_pass" id="rcp_user_pass" class="required" type="password"/>
				<label for="rcp_user_pass">
					<?php 
    _e('Password', 'rcp');
    ?>
					<span class="rcp_lost_password"><a href="<?php 
    echo esc_url(wp_lostpassword_url(rcp_get_current_url()));
    ?>
"><?php 
    _e('I have forgotten', 'stag');
    ?>
</a></span>
				</label>
			</p>
			<p class="unit span-grid rcp_submit">
				<input type="hidden" name="rcp_action" value="login"/>
				<input type="hidden" name="rcp_redirect" value="<?php 
    echo esc_url($rcp_login_form_args['redirect']);
    ?>
"/>
				<input type="hidden" name="rcp_login_nonce" value="<?php 
    echo wp_create_nonce('rcp-login-nonce');
					<?php endif; ?>
				</select>
			</p>
			<p>
				<label for="rcp_email"><?php _e( 'Email Address', 'rcp' ); ?></label>
				<input name="rcp_email" id="rcp_email" class="text rcp-input required" type="email" value="<?php echo $current_user->user_email; ?>" />
			</p>
			<?php do_action( 'rcp_profile_editor_after', $current_user->ID ); ?>
			<legend><?php _e( 'Change your Password', 'rcp' ); ?></legend>
			<p id="rcp_profile_password_wrap">
				<label for="rcp_user_pass"><?php _e( 'New Password', 'rcp' ); ?></label>
				<input name="rcp_new_user_pass1" id="rcp_new_user_pass1" class="password rcp-input" type="password"/>
			</p>
			<p id="rcp_profile_password_confirm_wrap">
				<label for="rcp_user_pass"><?php _e( 'Re-enter Password', 'rcp' ); ?></label>
				<input name="rcp_new_user_pass2" id="rcp_new_user_pass2" class="password rcp-input" type="password"/>
			</p>
			<p class="rcp_password_change_notice"><?php _e( 'Please note after changing your password, you must log back in.', 'rcp' ); ?></p>
			<p id="rcp_profile_submit_wrap">
				<input type="hidden" name="rcp_profile_editor_nonce" value="<?php echo wp_create_nonce( 'rcp-profile-editor-nonce' ); ?>"/>
				<input type="hidden" name="rcp_action" value="edit_user_profile" />
				<input type="hidden" name="rcp_redirect" value="<?php echo esc_url( rcp_get_current_url() ); ?>" />
				<input name="rcp_profile_editor_submit" id="rcp_profile_editor_submit" type="submit" class="rcp_submit" value="<?php _e( 'Save Changes', 'rcp' ); ?>"/>
			</p>
		</fieldset>
	</form><!-- #rcp_profile_editor_form -->
	<?php
else:
	echo '<p>' . __( 'You need to login to edit your profile.', 'rcp' ) . '</p>';
	echo rcp_login_form_fields();
endif;
	</h3>
<?php } else { ?>
	<h3 class="rcp_header">
		<?php echo apply_filters( 'rcp_registration_header_logged_out', __( 'Upgrade Your Subscription', 'rcp' ) ); ?>
	</h3>
<?php }

// show any error messages after form submission
rcp_show_error_messages( 'register' ); ?>

<form id="rcp_registration_form" class="rcp_form" method="POST" action="<?php echo esc_url( rcp_get_current_url() ); ?>">

	<?php if( ! is_user_logged_in() ) { ?>

	<div class="rcp_login_link">
		<p><?php _e( sprintf( '<a href="%s">Log in</a> if you wish to renew an existing subscription.', rcp_get_login_url( rcp_get_current_url() ) ), 'rcp' ); ?></p>
	</div>

	<?php do_action( 'rcp_before_register_form_fields' ); ?>

	<fieldset class="rcp_user_fieldset">
		<p id="rcp_user_login_wrap">
			<label for="rcp_user_login"><?php echo apply_filters ( 'rcp_registration_username_label', __( 'Username', 'rcp' ) ); ?></label>
			<input name="rcp_user_login" id="rcp_user_login" class="required" type="text" <?php if( isset( $_POST['rcp_user_login'] ) ) { echo 'value="' . esc_attr( $_POST['rcp_user_login'] ) . '"'; } ?>/>
		</p>
		<p id="rcp_user_email_wrap">
			<label for="rcp_user_email"><?php echo apply_filters ( 'rcp_registration_email_label', __( 'Email', 'rcp' ) ); ?></label>
			<input name="rcp_user_email" id="rcp_user_email" class="required" type="text" <?php if( isset( $_POST['rcp_user_email'] ) ) { echo 'value="' . esc_attr( $_POST['rcp_user_email'] ) . '"'; } ?>/>
		</p>
		<p id="rcp_user_first_wrap">
			<label for="rcp_user_first"><?php echo apply_filters ( 'rcp_registration_firstname_label', __( 'First Name', 'rcp' ) ); ?></label>
// show any error messages after form submission
rcp_show_error_messages('register');
?>

<form id="rcp_registration_form" class="rcp_form" method="POST" action="<?php 
echo esc_url(rcp_get_current_url());
?>
">

	<?php 
if (!is_user_logged_in()) {
    ?>

	<div class="rcp_login_link">
		<p><?php 
    printf(__('<a href="%s">Log in</a> if you wish to renew an existing subscription.', 'rcp'), rcp_get_login_url(rcp_get_current_url()));
    ?>
</p>
	</div>

	<?php 
    do_action('rcp_before_register_form_fields');
    ?>

	<fieldset class="rcp_user_fieldset">
		<p id="rcp_user_login_wrap">
			<label for="rcp_user_login"><?php 
    echo apply_filters('rcp_registration_username_label', __('Username', 'rcp'));
    ?>
</label>
			<input name="rcp_user_login" id="rcp_user_login" class="required" type="text" <?php 
function rcp_login_form( $atts, $content = null ) {

	global $post;

	$current_page = rcp_get_current_url();

	extract( shortcode_atts( array(
		'redirect' 	=> $current_page,
		'class' 	=> 'rcp_form'
	), $atts ) );

	$output = '';

	global $rcp_load_css;

	// set this to true so the CSS is loaded
	$rcp_load_css = true;

	if ( isset($_REQUEST['rcp_action']) && $_REQUEST['rcp_action'] === "lostpassword") {
		$output = rcp_lostpassword_form_fields();
	} elseif ( isset($_REQUEST['rcp_action']) && $_REQUEST['rcp_action'] === "lostpassword_checkemail") {
		$output = rcp_lostpassword_checkemail_message();
	} elseif ( isset($_REQUEST['rcp_action']) && $_REQUEST['rcp_action'] === "lostpassword_reset") {
		$output = rcp_change_password_form( array( 'redirect' => $redirect) );
	} else {
		$output = rcp_login_form_fields( array( 'redirect' => $redirect, 'class' => $class ) );
	}

	return $output;
}
Exemple #13
0
		<fieldset class="rcp_login_data">
			<p>
				<label for="rcp_user_Login"><?php _e( 'Username', 'rcp' ); ?></label>
				<input name="rcp_user_login" id="rcp_user_login" class="required" type="text"/>
			</p>
			<p>
				<label for="rcp_user_pass"><?php _e( 'Password', 'rcp' ); ?></label>
				<input name="rcp_user_pass" id="rcp_user_pass" class="required" type="password"/>
			</p>
			<?php do_action( 'rcp_login_form_fields_before_submit' ); ?>
			<p>
				<label for="rcp_user_remember"><?php _e( 'Remember', 'rcp' ); ?></label>
				<input type="checkbox" name="rcp_user_remember" id="rcp_user_remember" value="1"/>
			</p>
			<p class="rcp_lost_password"><a href="<?php echo esc_url( wp_lostpassword_url( rcp_get_current_url() ) ); ?>"><?php _e( 'Lost your password?', 'rcp' ); ?></a></p>
			<p>
				<input type="hidden" name="rcp_action" value="login"/>
				<input type="hidden" name="rcp_redirect" value="<?php echo esc_url( $rcp_login_form_args['redirect'] ); ?>"/>
				<input type="hidden" name="rcp_login_nonce" value="<?php echo wp_create_nonce( 'rcp-login-nonce' ); ?>"/>
				<input id="rcp_login_submit" type="submit" value="Login"/>
			</p>
			<?php do_action( 'rcp_login_form_fields_after_submit' ); ?>
		</fieldset>

		<?php do_action( 'rcp_after_login_form_fields' ); ?>

	</form>
<?php else : ?>
	<div class="rcp_logged_in"><a href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'rcp' ); ?></a></div>
<?php endif; ?>