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 );
}
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
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
Ok.. do you know if it possible to add a new user to one more subsite in the wordpress multisite? with a function?
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