Hi @stefang88
Is your test subscriber added to the subsite? You need a custom code to register a user to a subsite automatically via UM Register Form with the following code:
add_action("um_registration_complete", "um_add_user_to_main_site", 99, 2);
function um_add_user_to_main_site( $user_id, $args ){
if( isset( $args['form_id'] ) && $args['form_id'] == 756 ){
$blog_id = 1;
um_fetch_user( $user_id );
$role = um_user("role");
add_user_to_blog( $blog_id, $user_id, $role );
}
}
form_id – this should match your Register Form ID
blog_id – this should be the blog ID of the subsite that you want to register the user.
Regards,
Hi @champsupertramp
The Test subscriber has registered to the main site.
I’ve used the code provider and put it on the main site functions but the new registered user is still not syncing to the subsite.
Just so we are on the right track. Would something like this help with when I sign/register into main site as a subscriber then try navigate to site B, will it allow subscribers to go to the subsite without logging in again?
Hi @stefang88
Sorry for the late response. By default, users can log in to the main site and then access the subsite and still remains logged in.
Could you please check if you have added the correct blog ID to the code I’ve provided above? You can check it in http://yoursite.com/wp-admin/network/sites.php and then hover on the “Edit” link in the sites table. It should show the ID in the browser status.
Regards,
Hi @stefang88
Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help… 🙂