IF payment completed do – buddypress wordpress

I’m working on buddypress custom subscription form.

At the moment accounts are created just after filling the membership form, it means, a lot of accounts are created without paying. We want to clean up this mess.

Read More

I’d like to move account to be created at the end of the payment step.

$anyerrors = $error->get_error_code();
if(is_wp_error($error) && !empty($anyerrors)) {
        $messages = $error->get_error_messages();
        $content .= '<p class="error" id="reg-error" style="display: block;">';
        $content .= implode('<br/>', $messages);
        $content .= '</p>';
        // Show the page so that it can display the errors
        $content = $this->output_registeruser( $content, $_POST );
    } else {
        $content = $this->output_paymentpage( $user_id );
        // everything seems fine (so far), so we have our queued user so let's
        // run the bp complete signup action
        do_action( 'bp_complete_signup' );
        // display the payment forms
        if(!defined('MEMBERSHIP_NOLOGINONREGISTRATION')) {
            if(!headers_sent()) {
                    wp_set_current_user($user_id);
                    wp_set_auth_cookie($user_id);
                    }
        }

$content = $this->output_paymentpage( $user_id ); this line is responsible for redirecting to PayPal.

do_action( ‘bp_complete_signup’ ); This one is for creating account.

I want to know if there is any way to get ‘reply’ with true/false from PayPal if payment is completed or not.

How to do it in proper way?

Thanks in advance,
Adam

Related posts

Leave a Reply

1 comment