Is there a is_user_logged_in() function for WordPress MU / Multisite (3.0+) where I can add in the network site ID like is_user_logged_in(2)
where 2
would be the site_id?
Update:
After a little digging I came up with the code below. Unfortunately it does not work.
//don't use this. does not work. function mu_logged_in($blog_id){ switch_to_blog($blog_id); $status = is_user_logged_in(); restore_current_blog(); return $status; }
anu’s answer and comments are good.
also, make sure you have the cookie domain set correctly in the wp-config.php file 🙂
Yes, and no!
The way users work in a multisite scenario is that there is a single pool of users, who are then associated with blogs.
So, logged in status is common across all the blogs, but you can use
is_blog_user($blog_id)
to determine whether the current logged in user is a member of that blog. An example:Codex page for
is_blog_user()