Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active May 17, 2017 19:55

Revisions

  1. Pebblo revised this gist May 17, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion example.php
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    <?php //Please do not include the opening PHP tag if you already have one

    //Function to allow you to use BuddyPress registration as the 'alternative registration url'
    //Function to allow you to use BuddyPress registration as for site registrations during the EE Checkout
    //and then redirect them back to the checkout.
    function tw_ee_bp_redirect($user_id) {
    $checkout = EE_Registry::instance()->SSN->checkout();

  2. Pebblo created this gist May 17, 2017.
    20 changes: 20 additions & 0 deletions example.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    <?php //Please do not include the opening PHP tag if you already have one

    //Function to allow you to use BuddyPress registration as the 'alternative registration url'
    function tw_ee_bp_redirect($user_id) {
    $checkout = EE_Registry::instance()->SSN->checkout();

    if( $checkout instanceof EE_Checkout ) {

    $user = get_user_by( 'id', $user_id);
    if( $user ) {
    wp_set_current_user( $user->ID, $user->user_login );
    wp_set_auth_cookie( $user->ID );
    do_action( 'wp_login', $user->user_login );

    wp_safe_redirect( $checkout->reg_page_base_url );
    exit;
    }
    }
    }
    add_action('bp_core_signup_user', 'tw_ee_bp_redirect', 100, 1);