Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirection Issue regarding activation

  • hey,
    I created custom login and registration pages for my buddypress installation and now if a new user registers and tries to login without activating his/her account first, he/she gets redirected to the wordpress login.
    how can i redirect them to the custom login or registration page??

    thanks

Viewing 1 replies (of 1 total)
  • I found a way to accomplish it…
    Paste this piece of code in your theme functions file..

    `// Stop user accounts logging in that have not been activated (user_status = 2)
    function bp_core_signup_disable_inactive_modified( $auth_obj, $username ) {
    global $bp, $wpdb;

    if ( !$user_id = bp_core_get_userid( $username ) )
    return $auth_obj;

    $user_status = (int) $wpdb->get_var( $wpdb->prepare( “SELECT user_status FROM $wpdb->users WHERE ID = %d”, $user_id ) );

    if ( 2 == $user_status )
    header(“Location:”.get_site_url().”/login?err=not-activated”); /*Your Custom Message*/
    else
    return $auth_obj;
    }
    add_filter( ‘authenticate’, ‘bp_core_signup_disable_inactive_modified’, 30, 2 );
    `

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.