How do you disable account activation in WPMU and then log the user in right away?

Is there a way to disable account activation for WPMU then log the user in and redirect them to another page?

I am running on WPMU with BuddyPress.

Related posts

Leave a Reply

2 comments

  1. In a WPMU setup the account information is sent to the wp_signup table before being passed to the wp_users table.

    an easy fix for this is:

    function your_disable_activation( $user, $user_email, $key, $meta = '' ) {
        // Activate the user
        $user_id = wpmu_activate_signup( $key );
    
        wp_set_auth_cookie( $user_id, true, is_ssl() );
    
        wp_redirect( /*redirect to */ site_url() );
        exit;
    
    }
    add_filter( 'wpmu_signup_user_notification', 'your_disable_activation', 10, 4 );
    
  2. This is for future reference:

    Currently: WordPress 4.5 (Date: 04/28/16 | With the nag message to update to WP 4.5.1)

    My tweaked version:

    // -- Originally in the post, not sure if this is necessary
    // -- remove_filter('wpmu_signup_blog_notification', 'activate_on_blog_signup');
    
    // This function runs after Sign Up Step 2
    function activate_user_and_blog( $domain, $path, $title, $user, $user_email, $key, $meta ) {
      // Activate website right blog registration
      $blogID = wpmu_activate_signup($key);
    
      // Get the URL of the new blog
      $blogURL = get_blogaddress_by_id($blogID['blog_id']);
    
      // Redirect the user to their blog Dashboard
      wp_redirect(trailingslashit($blogURL) . 'dashboard');
    
      // wp_redirect( home_url() );  // Redirect to home page
      exit;
    }
    add_filter('wpmu_signup_blog_notification', 'activate_user_and_blog', 10, 7 );
    

    Originally found via: https://premium.wpmudev.org/forums/topic/skip-redirect-past-the-congratulations-your-blog-is-ready