Skip to:
Content
Pages
Categories
Search
Top
Bottom

disable auto activation and redirect to external website


  • traceykin
    Participant

    @traceykin

    Hi

    I was wondering if you could help me please with php.

    After the user fills in the create an account section and base register form I would like 2 things to happen when the user the hits complete signup button.

    1. Disable the auto activation so I can assign a member group in the wordpress users section
    2. Redirect to an external website for their tiered membership payment

    I have tried this for the redirection but I cant get it to work (I added the URL). I placed it in the child theme’s function.php

    function ps_bp_redirect($user) {
    $redirect_url = ‘url goes here’;
    wp_safe_redirect( add_query_arg( array( ‘user’ => $_POST[‘signup_username’] , ’email’=> $_POST[‘signup_email’]), $redirect_url ) );
    }
    add_action(‘bp_core_signup_user’, ‘ps_bp_redirect’, 100, 1);

    and I used this to stop the auto activation and this works perfect. I added the code to snippets plugin.

    add_filter( ‘bp_core_signup_send_activation_key’, ‘ps_disable_activation_email’ );
    function ps_disable_activation_email() {
    return false;
    }
    add_filter( ‘gettext’, ‘ps_change_activation_message’, 20, 3 );

    function ps_change_activation_message( $translated_text, $text, $domain ) {

    switch ( $translated_text ) {
    case ‘You have successfully created your account! To begin using this site you will need to activate your account via the email we have just sent to your address.’ :
    $translated_text = __( ‘Your membership account is awaiting approval by the site administrator.’, ‘buddypress’ );
    break;
    }

    return $translated_text;
    }

    I am using the newest version of wordpress and buddypress Version 7.3.0

    Many thanks and kind regards

    Tracey Kinchella

Viewing 3 replies - 1 through 3 (of 3 total)

  • traceykin
    Participant

    @traceykin

    Hi the redirection is sort of working but redirecting to the /wp-login.php screen

    Anyone know how I can get it to redirect to an external website please.

    function bp_redirect($user) {
    $redirect_url = ‘https://another_website’;
    bp_core_redirect($redirect_url);
    }

    add_action(‘bp_core_signup_user’, ‘bp_redirect’, 100, 1);


    shanebp
    Moderator

    @shanebp

    Try wp_redirect for external urls.


    traceykin
    Participant

    @traceykin

    Thank you Shane

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar