Automatic blog creation using username (only users can register)?

I would like to automate blog creation using usernames.

** or even just blog default to username for url. Doesn’t really matter about the rest.

Is there a way to do this?

Can someone help me figure this out?

Kindly,

Paul

  • Adam Czajczyk
    • Support Gorilla

    Hey Paul,

    I hope you’re well today and thank you for your question!

    I can see that you’ve asked similar question recently here:

    https://premium.wpmudev.org/forums/topic/automatic-blog-creation-with-registered-username-as-blog-url

    As my colleague @vinod Dalvi said, this would require a custom coding which is way beyond the scope of this support forum. I think you may want to post a question at our “Jobs & Pros” job board here (please note that there’s no WPMU DEV staff there!):

    https://premium.wpmudev.org/wordpress-development/

    That being said, this code might be of help:

    https://gist.github.com/davejamesmiller/1966407

    The idea here is to automatically create blog by giving only a Site Title. Taking this as a base it should be possible to use username instead of site title and to hook this code to registration process.

    I hope this helps!

    Cheers,

    Adam

  • Ash
    • WordPress Hacker

    Hello @paul

    I hope you are well today.

    Please go to Network Admin > Settings > Registration Settings > Allow new registrations > And select “User accounts may be registered.”.

    Then use the following code:

    add_action( 'user_register', 'create_new_blog', 10, 1 );
    function create_new_blog( $user_id ) {
    $user_info = get_userdata( $user_id );
    wpmu_create_blog( $user_info->user_login, '/'.$user_info->user_login.'/', $user_info->user_login, $user_id , array( 'public' => 1 ) );
    }

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name ‘mu-plugins’. If there is no folder in that name, then create a folder, name it ‘mu-plugins’, create a file inside that, give any name you like and paste the code in there. You don’t need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers

    Ash

  • Paul
    • The Crimson Coder

    @ashok

    @adam Czajczyk

    Thank you all very much. It’s hard to ask questions on here because I want to be clever enough to do it all myself. But I am very grateful for all your hard work and knowledge.

    Thanks again for the support and solutions. I will definitely be continuing with WPMUDEV when it’s time to renew my subscription. You guys have been invaluable!

    I have not tested this yet, but I will do so very soon.

    Kindly,

    Paul

  • Paul
    • The Crimson Coder

    @ashok,

    It seems after activating AntiSplog the form has reverted back to asking for sitename and title. Is there a way to work around this? The plugin worked perfectly before!

    Now that I have the rename wp-signup.php running it has reverted to original.

    Please if you could assist with this, that would be perfect.

    Most Kindly,

    Paul

  • Paul
    • The Crimson Coder

    @ashok

    I think I may be mistaken. For clarification… This function automatically creates a blog site for my new registered users?

    Or is it only designed to implant the username and ask only for the site title?

    Reason I ask, I created a new user and the blog site was automatic. If this is what the function is for, then that is brilliant!

    Please clarify if possible.

    Kindly,

    Paul

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.