This support ticket is created 5 years, 5 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I am trying to: Hi, I have a function that auto add a site in my multisite network when register on the main page: looks 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 );
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 ) );
}
}
I can't get it to work with user form... No sub sites is created. What can be the issue?
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==12)
{
$user_info = get_userdata( $post_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 ) );
}
}
}
Add it to your functions.php file and change the 12 to the ID of you form.
Oh I didnt change the form ID, so it works perfect. Now I have one last question, the new user is now added to two pages. main site (weareyou.online) and weareyou.online/username. Can you delete the user from the main site? The new user should only be added to his subsite
I found the problem. But now my client wants the new pages that are created to have URL: hidden link.
And if a user has the same name, add a number: hidden link. Do you think you have a solution for that?:)
I'm so grateful for your help!
I think if an existing user has url: /john-anderson. Then the next person with the same name get /john-anderson1 and the next /john-anderson2. But maybe it's hard? User ID may be a better solution.
Now another issue has emerged as well. My clien wants to be able to approve new users before they are registered? Is that possible?