3

Is there a way to maintain logged-in status across sub-domains? I've tried adding a cookie prefix in config.php to no avail... not sure what else to try.

James

5

It seems like you can set a "cookie_domain" variable to the config.php. Just figured this out by having a quick look at expressionengine/core/EE_Config.php around line 277. For cross sub domains persisting cookie, I believe your domain should be one of the seven special ones (http://wp.netscape.com/newsref/std/cookie_spec.html). In short $config['cookie_domain'] = ".yourdomain.com" would be worth a try!

| improve this answer | |
  • Glad I could help! – Matt Jan 13 '13 at 12:09
3

You need to enable multi-site login via the config.php file. You add a statement like:

$config['multi_login_sites'] = "http://domain.org/|http://domain2.org/";

for each site/domain that they are logging into. Now the downside of this, is if you are logging them into a number of sites, the user will see a series of login flashes, from the EE successful login screen. I'm not certain if there is a way to remove that.

I know for the clients we've done this for, we reduced the multi-site logins to just the sites were people could place orders, submit forms, etc., as opposed to trying to login them into all sub sites at once.

If there are a lot of sites, and the user needs to be logged into all of them, then I recommend taking a look at this Stackoverflow question and response, on how sites like Facebook handle it.

| improve this answer | |
  • This is really great info, never knew about this approach - However in this particular case it's all about sub-domains of a single TLD, not multiple domain names, and as such the answer from @mfauveau works. Also reveals to me what the member_member_login_multi extension hook might be for... never understood that before due to apparent lack of docs... ellislab.com/expressionengine/user-guide/development/… – James Smith Jan 13 '13 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.