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
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
Hmm, ok, is it hard to setup test payment?
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
I do not know if I understand correctly, but I have enabled test mode payment, I think 🙂
And do you think it will work when I go "live" / "real payment"?
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..:/
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
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
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');
}
}
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
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');
}
}
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
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');
}