I am trying to login programmatically from a subdomain of the type: app.mysite.com and I want to log in the user into the main network site and the site he own.
I am using the following code with no success:
wp_set_current_user( $user_id );
wp_set_auth_cookie( $user_id );
I just want to mimic the default login form action when logged in from the main site, but the code above only log the user in to the current subdomain the code is executed on, and I need the user to be logged in as if he used the mysite.com/login instead of app.mysite.com/login.
So basically, I want the user to be logged into the main site and the sites he owns, programmatically from a script placed on app.mysite.com.
I hope it is clear.