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.

Do you know any multisite plugin which allows users to create a user account and a site after a form submission. After the form submission, the form will automatically add a site in the network admin and create a new user. Is this possible? Some say that it needs hardcoding for it to work. But I have no idea how to. Hope you guys can help.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

create a form, same as contact or custom content from frontend and send the content of field with the WP core function wp_insert_user() to WP, add the users.

an example without form, only a function to insert users and see the fields for the data array.

function fb_wp_insert_user() {
    $user_data = array(
        'ID' => '',
        'user_pass' => wp_generate_password(),
        'user_login' => 'dummy',
        'user_nicename' => 'Dummy',
        'user_url' => '',
        'user_email' => 'dummy@example.com',
        'display_name' => 'Dummy',
        'nickname' => 'dummy',
        'first_name' => 'Dummy',
        'user_registered' => '2010-05-15 05:55:55',
        'role' => get_option('default_role') // Use default role or another role, e.g. 'editor'
    );
    $user_id = wp_insert_user( $user_data );
}

I think is an good idea, that you check the user, before you add the entry on email or name. But you can also update via function: wp_update_user()

share|improve this answer
    
thanks. this one worked for me. this would be a big help. ;p –  Jivers Leuman Mar 29 '12 at 7:21
    
Thank you for this code. Please can you tell us how to create a subsite for that specific user, from front end? –  whiteletters and blankspaces Jul 5 '13 at 0:52
add comment

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.