Skip Navigation

[Resolved] Add site to new user, multisite.

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 50 replies, has 2 voices.

Last updated by Shane 6 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#1149374

Like this i meant $user_info =

add_action( 'user_register', 'user_registration_create_site', 10, 1 );

function user_registration_create_site( $user_id ) {

if ( isset( $user_info->user_login ) ) {

$main_site = 'weareyou.online'; // Add your main domain here
wpmu_create_blog( $main_site, '/'.$user_info->user_login.'/', $user_info->user_login, $user_id , array( 'public' => 1 ) );
update_user_meta($user_id, 'first_name', 'test');
}

$user_info = get_userdata( $user_id );
}

#1149383

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicklas,

Do it like this
add_action( 'user_register', 'user_registration_create_site', 10, 1 );

function user_registration_create_site( $user_id ) {

$user_info = get_userdata( $user_id );
update_user_meta($user_id, 'first_name', 'test');

}

Just to ensure it works.

Thanks,
Shane

#1149396

Did not work:/

#1149404

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicklas,

Not sure how much assistance I can provide since you are using the Woocommerce subscription plugin.

It would be best to get in contact with them because they may have a special hook that you can add the code to.

They might be using some other method to add the user to the database.

Thanks,
Shane

#1149413

Ok.. do you know if it possible to add a new user to one more subsite in the wordpress multisite? with a function?

#1150066

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicklas,

If the site is already existing then you would use this function.
https://codex.wordpress.org/Function_Reference/add_user_to_blog

Thanks,
Shane