Indeed, get_active_blog_for_user
should work.
$blog = get_active_blog_for_user( get_current_user_id() );
$blog_url = $blog->domain... /* or $blog->path, together with $blog->siteurl */
Alternatively:
$blog_id = get_active_blog_for_user( get_current_user_id() )->blog_id;
// note: changed "->userblog_id" to "->blog_id" in row above to make it work.
switch_to_blog( $blog_id ); /* switch context */
$home_url = home_url();
restore_current_blog(); /* back */
Related Posts:
- Can you have multi-site WP and keep users separate?
- Good way to block users within a multisite setup without deleting them?
- Subsite access without being a member of the subsite in wp multisite network
- Users getting linked unwanted to main mu in WordPress multisite (WPMU)
- Multisite Login Access Restrictions
- How To Add Custom Form Fields To The User Profile Page?
- Why are my roles not visible in a Multi-site/Network?
- How to use same email for multiple users
- Where can I find documentation on what characters are allowed in user names and why?
- Is there a is_user_logged_in() for multisite?
- WordPress Multisite allow site admin to add user without email confirmation
- wordpress multisite, how to keep user on subdomain throughout registration process?
- Troubleshooting a “You do not have sufficient permissions to access this page” error
- WordPress Multisite – When a user signs-up on main site, how to add the user to a subsite
- How to use alias domain for multisite installation?
- Different back-end colour scheme for the different sites of a multisite
- Set up collaborative site
- Restrict users on multisite WordPress install
- How does WordPress connect sites and the wp_users table?
- Prevent user creating new users with specific roles
- Allowing logged in users to comment without moderation across a multisite installation
- Restrict the user access in multi site for non-assigned blogs
- How to add multiple existing users to a multisite site?
- Why can’t I delete original user in multisite? Options for manual removal
- How to add edit users capability to a custom role?
- WPMU – new users are automatically subscribed to the main blog – how to prevent that?
- WP Multisite Static Frontpage
- In MultiSite, can some users automatically have Site Admin rights on all sites, without granting them Network Admin access?
- How can I delete a user from entire multisite nework
- How to search users globally on a multisite install?
- Update User Role Across Network when Main Site User is Updated
- Assign role to user on first login, if they are first (after admin)
- Get the User ID Who Owns a Given Blog ID in Multisite
- Make a user administrator to a sub directory site and a contributor to main site in multisite network
- Query users by capability – uninstall/deactivate callback
- How to change user starting role in WordPress MultiSite?
- Multisite – One user allowed access to all sites?
- How do you disable account activation in WPMU and then log the user in right away?
- How to protect post attachments related to a custom post type, from non-logged in users, on 1 subsite of a multisite installation?
- WordPress Multisite Strange Redirect on Primary Site
- Multisite registration problem [closed]
- Four columns in the wp_users table
- Create Custom Multisite User Role to Reduce Capabilities
- Obtaining user table for one site on multisite set up
- WordPress stuck in deleting user
- Multi-Site Subfolder User Permission Issue
- How to display users with posts published between two dates (Sorted by Post-Count) [Multisite]
- Get users registered 30 days ago(or more)
- Bulk Move Users from one site to another within a network ( Multisite )
- WordPress Multisite – Load users using custom query
- Add access control origin header information across multisite
- Copy user role on multisite so the user can access subsites with same role
- One Site as a part of Multisite to be hidden (Un-published) from Public?
- How To Disable Add new users On Subsites In Multisite?
- Wait ajax to complete before continue loop
- Combining user database tables while keeping all other data in seperate for multiple sites?
- How to fix that new users show up again in subsite of a Multisite?
- How to delete user from MU site when the user is removed from their site?
- WordPress Multisite Add User
- Sharing users across multiple sites, each on their own database
- Customize or avoid new admin email address notification
- Disable site visiting and user logins excepting for a specific user
- How to share User Database between Two Multisite Installations + More
- Using Same User Database on Subdomain
- How to get the blogs owned by a user?
- Hiding media uploaded by other users in wordpress multisite?
- How to redirect user after session timeout
- Common user login for two different wordpress installation and bbpress
- How to check main site user level from subsite in a multisite network
- Give users acces to admin a single post or set up WP network?
- can’t create user without email for an author after converting single site to multisite
- Restrict users of site 1 to login in site 2 in wordpress multisite
- “My Sites” incorrectly showing all network sites for all logged in users
- How to use the same users table on multiple wordpress sites
- Easily adding multiple existing users to a multisite site
- Possible to have duplicate usernames on different two multisites
- Multisite – each site with it’s own set of users
- Modify new user email notification in network admin screen wp multisite
- Multisite – site user limited only for this site
- Can’t activate a user on multisite install
- Importing Posts into New Website with Same User ID’s
- WordPress automatic Login on other page?
- A different role for each site in a multisite
- WordPress Multisite FQDN Admin Access
- Should I use MultiSite for a subdomain based wp site?
- Get current user outside of WordPress Multisite
- How to create child/sub user under parent user
- How create a multisite setup with “phantom” accounts and passwords?
- WordPress MU users – how are they organized?
- Is there any way to give all users access to one blog in a multisite network without using a plugin?
- Some Subdomains on a Multisite Install Not Found
- Redirect authors from upload.php url to Home page in Multisite
- WordPress multi user registration sites
- rename index or homepage
- Registration Page
- Using a number for limiting registering or banning on multisite
- Unsure of my options, Multi-blog?
- WordPress Multisite (Network) some site users added to main site users list as subscriber
- WordPress Multisite restict user access
- Change a subsite Admin role of a WordPress Multisite after 24 hours registering