We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Multisite Log In - so close!

Development and Programming

interactive @dvl's avatar
interactive @dvl
144 posts
14 years ago
interactive @dvl's avatar interactive @dvl

Hi,

I’ve been going around and around on this one! I have a main site and 30 other sites using Multisite Manager. I want the user to be able to log in to any one of those other sites and at the same time be logged in to the main site (they do not need to be logged in to all 31 sites). I can get it to work using the information on this wiki page. (In my case, it only worked if I left off “index.php” even though I am using MSM - I think because I’m taking the index page off in the htaccess file).

But I can’t do more than 15 or so sites in the $config[‘multi_login_sites’] variable because it works by redirecting to each site on the list and setting a cookie and browsers have a limit of how many redirects you can do.

So, what I thought to do was define the list in $config[‘multi_login_sites’] by determing which domain I’m on. It looks like this:

$domain = $_SERVER['HTTP_HOST'];
if ($domain == 'www.SiteB.com') {
  $config['multi_login_sites'] = "http://www.MainSite.com/|http://www.SiteB.com/"; 
} else {
  $config['multi_login_sites'] = "http://www.MainSite.com/";
}

Now when I log in on SiteB, I can see that the $config[‘multi_login_sites’] variable has the right thing, two sites instead of just the main site. And I get logged in to both sites. But I get these errors on the confirmation page:

A PHP Error was encountered
Severity: Notice
Message: Undefined index: 2
Filename: member/mod.member_auth.php
Line Number: 243

A PHP Error was encountered
Severity: Notice
Message: Undefined index: 2
Filename: member/mod.member_auth.php
Line Number: 244

The confirmation page is on www.MainSite.com, not www.SiteB.com if that makes a difference.

I see the errors, but only intermittently, if I log in as something other than a super user. But the real problem is that the “Back” button doesn’t work and there is no redirect so it leaves the user stranded.

Does anyone know why it would work without the “If” statement? I have copied the $config[‘multi_login_sites’] exactly so there is no difference between it except that the way that works doesn’t use an “if” statement.

Just for fun, I also tried a “switch” statement - same thing, the variable that shows on the browser for $config[‘multi_login_sites’] is correct but the cookie is not set on MainSite, only on the site I’m logging in from.

Any help at all would be greatly appreciated!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.