wpmu_signup_user example

if ( $errors->has_errors() ) {
        signup_user( $user_name$user_email$errors );
        return false;
    }

    if ( 'blog' === $_POST['signup_for'] ) {
        signup_blog( $user_name$user_email );
        return false;
    }

    /** This filter is documented in wp-signup.php */
    wpmu_signup_user( $user_name$user_emailapply_filters( 'add_signup_meta', array() ) );

    confirm_user_signup( $user_name$user_email );
    return true;
}

/** * Shows a message confirming that the new user has been registered and is awaiting activation. * * @since MU (3.0.0) * * @param string $user_name The username. * @param string $user_email The user's email address. */
        $new_user_email = wp_unslash( $_REQUEST['email'] );
        $user_details   = wpmu_validate_user_signup( $_REQUEST['user_login']$new_user_email );
        if ( is_wp_error( $user_details['errors'] ) && $user_details['errors']->has_errors() ) {
            $add_user_errors = $user_details['errors'];
        } else {
            /** This filter is documented in wp-includes/user.php */
            $new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) );
            if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) {
                add_filter( 'wpmu_signup_user_notification', '__return_false' );  // Disable confirmation email.                 add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email.             }
            wpmu_signup_user(
                $new_user_login,
                $new_user_email,
                array(
                    'add_to_blog' => get_current_blog_id(),
                    'new_role'    => $_REQUEST['role'],
                )
            );
            if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) {
                $key      = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login$new_user_email ) );
                $new_user = wpmu_activate_signup( $key );
                if ( is_wp_error( $new_user ) ) {
                    
Home | Imprint | This part of the site doesn't use cookies.