Automatic blog creation with registered username as blog url.

Is there a way to have a blog automatically made when a user registers and their username as the blog url?

I would like to set this up so my affiliates could sign up and a blog with their username is created for them with their username.

I will need to add their reference like: ?ref=username
So their blog url will look like this: http://www.MySite.com?ref=username

Can someone help me with a function that can automate this for me.

Kindly,

Paul.

  • Vinod Dalvi
    • WP Unicorn

    Hi Paul,

    I hope you are well today and thank you for your question.

    You have to develop cuastom code to create a blog automatically when a user registers and their username as the blog url. You can just use the user_register hook that gets executed when the user registers and get user id of that newly registered user as argument of that function then use the get_userdata function to retrieve user name of that newly registered user using his user id and then create the new blog using that user id and user name using the wpmu_create_blog function.

    I will need to add their reference like: ?ref=username
    So their blog url will look like this: http://www.MySite.com?ref=username

    Do you want to make the subsite URLs of your multisite network like this?

    Kind Regards,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.