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
#1148172

Shane
Supporter

Languages: English (English )

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

Hi Nicklas,

How are your orders being set to completed?

Are you setting them as completed in the orders menu on the backend ?

Please let me know.
Thanks,
Shane

#1148178
paycomplet.jpg

Yes like this

#1148196

Shane
Supporter

Languages: English (English )

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

Hi Nicklas,

This is the problem.

The problem is that it needs to be set by the form itself in order for the hook to fire.

So you may need to setup some test payment gateway in woocommerce for this to work.

Thanks,
Shane

#1148200

Hmm, ok, is it hard to setup test payment?

#1148202

Shane
Supporter

Languages: English (English )

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

Hi Nicklas,

I'm not too experienced with this however you should be able to do this by going to the link below.
hidden link

Thanks,
Shane

#1148204
testmode.jpg

I do not know if I understand correctly, but I have enabled test mode payment, I think 🙂

#1148215

And do you think it will work when I go "live" / "real payment"?

#1148528

I have now set the order to both virtual & downloadabel and the order status is now completet automatically. But the user is still added to the main page only..:/

#1149176

Hi again, I need to use woocommerce subscription plugin.. and the user reg form dont support woocommerce subs. I started a new ticket whit a new qusetion..:) hope thats ok:)
/Nicklas

#1149209

Shane
Supporter

Languages: English (English )

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

Hi Nicklas,

No problem, are you saying you are switching the registration to the Woocommerce subscriptions option?

Unfortunately for this our Hooks won't work, so you will need to contact the plugin's support so that they can adopt the code to their hooks.

Thanks,
Shane

#1149255

Yes, I have to use Woocommerce subscriptions for this project. So this one will not work:
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 ) );
add_user_to_blog( $new_blog, $post_id, 'author');
}

}

#1149362

Shane
Supporter

Languages: English (English )

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

Hi Nicklas,

Try testing the hook to see if it fired by updating the user's first name.

update_user_meta($user_id, 'first_name', 'test');

This way we can know if the hook is actually firing.

Thanks,
Shane

#1149367

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 ) );
update_user_meta($user_id, 'first_name', 'test');
}

}

#1149372

Shane
Supporter

Languages: English (English )

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

Hi Nicklas,

I think I see the issue.
Add it on the outside the if statement below.

$user_info = get_userdata( $user_id );

Thanks,
Shane

#1149373

like this?

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');
}
update_user_meta($user_id, 'first_name', 'test');

}