wpmu_activate_signup example

$key = $_POST['key'];
}

if ( $key ) {
    $redirect_url = remove_query_arg( 'key' );

    if ( remove_query_arg( false ) !== $redirect_url ) {
        setcookie( $activate_cookie$key, 0, $activate_path, COOKIE_DOMAIN, is_ssl(), true );
        wp_safe_redirect( $redirect_url );
        exit;
    } else {
        $result = wpmu_activate_signup( $key );
    }
}

if ( null === $result && isset( $_COOKIE[ $activate_cookie ] ) ) {
    $key    = $_COOKIE[ $activate_cookie ];
    $result = wpmu_activate_signup( $key );
    setcookie( $activate_cookie, ' ', time() - YEAR_IN_SECONDS, $activate_path, COOKIE_DOMAIN, is_ssl(), true );
}

if ( null === $result || ( is_wp_error( $result ) && 'invalid_key' === $result->get_error_code() ) ) {
    status_header( 404 );
}
            }
            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 ) ) {
                    $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' ), 'user-new.php' );
                } elseif ( ! is_user_member_of_blog( $new_user['user_id'] ) ) {
                    $redirect = add_query_arg( array( 'update' => 'created_could_not_add' ), 'user-new.php' );
                } else {
                    $redirect = add_query_arg(
                        array(
                            'update'  => 'addnoconfirmation',
                            'user_id' => $new_user['user_id'],
                        ),
                        'user-new.php'
                    );
Home | Imprint | This part of the site doesn't use cookies.