x
 
Create New Page
 View Previous Changes    ( Last updated by Mel @ Emtwo )

Multiple Domain Login

Question:

I have many domains pointing to one site. When someone logs in they are only logged in from the domain they came in. How can I have them logged into all domains at once?

Answer:

You can set EE up to log you in to multiple domains if you need. Info taken from the top of:

system/modules/member/mod.member.php

Multi Site Login


The login routine can set cookies for multiple domains if needed.
This allows users who run separate domains for each blog to have a way to enable users to log-in once and remain logged-in across domains.

NOTE: In order to use this feature this array index must be added to your config.php file:

$conf['multi_login_sites'] = "http://www.example.com/|http://www.sitetwo.com";

Separate each domain with a pipe.

If using MSM, you should include index.php at the end of each domain:

$conf['multi_login_sites'] = "http://www.example.com/index.php|http://www.sitetwo.com/index.php";

Also be sure to set the following to “y” ONLY IF MSM IS INSTALLED:

$conf['multiple_sites_enabled'] = "y";

You must be sure that all needed fields in the alternate domain’s PATH.PHP are set:

$template_group = "site";
$template = "index";
$site_url = "http://example.com/";
$site_index = "index.php";
$site_404 = "";
$global_vars = array(); // This array must be associative

Without site_url and site_index, you’ll have issues with login on the alternate domain and logout on the primary.

You’ll also probably want to make sure you leave the “Cookie Domain” setting blank under ‘Admin > Cookie Settings’ if you go this route.

Category:Tricks

Categories: