Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it possible to have a form in WordPress that would allow more than one user to register at a time? So say I wanted to be able to add 5 users at once, is this possible to do with the default registration form or is that limited to one user?

It would be one form (or multiple, but need all to submit at once) on the front-end that the user could add multiple emails to and it would set them up as subscribers and send out the generated password to each email listed. I can't figure out a way to add more than one at a time.

Would be using something similar to this, but with multiple users.

<form id="register-form" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">
    <input type="hidden" name="user_login" value="Username" id="user_login" class="input" />
    <input type="hidden" name="user_email" value="E-Mail" id="user_email" class="input"  />
    <?php do_action('register_form'); ?>
</form>

Any ideas? Thanks

share|improve this question
    
It's an old plugin, but this -- dagondesign.com/articles/import-users-plugin-for-wordpress -- has worked for me in the past. –  Pat J Jul 11 '13 at 21:40
    
Looks like that is just for the backend, trying to figure out a way to be able to do it on the front-end. Thanks though –  ferne97 Jul 11 '13 at 22:04
2  
If I were you I would post your solution as an answer and accept it later. –  dalbaeb Jul 12 '13 at 0:19
    
Gotcha, moved it to an answer –  ferne97 Jul 12 '13 at 3:59

1 Answer 1

up vote 1 down vote accepted

Update

Found this awesome post http://tommcfarlin.com/create-a-user-in-wordpress/ that helped me solve the issue.

It was for a product in Shopp where a user can sign up multiple users for a training course, and each email needed to be registered as a subscriber.

This is the final code..

<?php
add_action( 'shopp_order_success', 'create_subscribers' );

function create_subscribers( $Purchase ) {

    foreach ( $Purchase->purchased as $purchase ) :

        $i = 1;
        while ( isset( $purchase->data['Email '.$i] ) ) :

            $email_address = $purchase->data['Email '.$i];

            if ( null == username_exists( $email_address ) ) :

                // Generate the password and create the user
                $password = wp_generate_password( 12, false );
                $user_id  = wp_create_user( $email_address, $password, $email_address );

                // Set the nickname
                wp_update_user(
                    array(
                        'ID'       =>    $user_id,
                        'nickname' =>    $email_address
                    )
                );

                // Set the role
                $user = new WP_User( $user_id );
                $user->set_role( 'subscriber' );

                // Email the user
                wp_mail( $email_address, 'Welcome!', 'Your Password: ' . $password );

            endif;
            $i++;
        endwhile;
    endforeach;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.