I've been working on a few sites for a client. The first of which can log in and have the session variable as well as a the {logged_in} tag read just fine.

The second, it doesn't matter how I log in (CP successfully logs in, for example, or through freemember or even EE's native membership form), it doesn't seem to read the {if logged_in} tag. The session variable is also blank.

Config files are lined up as explained in the MSM guide, and data can be written to the DB through channel forms, but I can't for the life of me figure out why I can't get the login state. It's driving me nuts.

I've gone as far as stripping down to the following code to test, and still nothing:

{if logged_in}
        $user_data = ee()->session->userdata("member_id");
        echo "UD: ".print_r($user_data,1);
    Email: {email}<br>
    GR ID: {group_id}<Br>
    ID: {member_id}<br>
    Name: {username}<br>
    LIMID: {logged_in_member_id}

{if logged_out}

Any ideas where to start looking for a solution?



You rockin' PHP on input our output for that template? Try just turning it off as well. Next, what EE version you running? Also, can you give me the output of this (when PHP is set to output for that template):

$a = "{member_id}";
$b = "{logged_in}";
echo "<br/><br/>";
  • PHP mode was on output. EE Version: v2.10.1 Output response: string(11) "0" string(11) "{logged_in}"
    – Vince
    Jul 9 '15 at 7:11

check that you are actually logged into site #2

did you login at site1.com/admin.php or site2.com/admin.php?

  • Sorry for the delay. I've logged on at site2.com/admin and site1.com/admin and neither of the two states seemed to affect the conditional.
    – Vince
    Jul 9 '15 at 7:06
  • I just tested this in a 4 site MSM setup in both a Vagrant box and live server in the wild: {if logged_in}<h3>You're logged in</h3>{if:else}<h3>Log in</h3>{/if} This works on all 4 sites. I cannot seem to be able to duplicate your issue. Perhaps there is something in your php environment that is preventing this? Try switching to cookie only authentication. Clear all your cookies, flush the browser cache, restart the computer and all that fun stuff. Does this persist when you try this from another computer?
    – Jim Wyse
    Jul 9 '15 at 13:11

Check you have different variables set under the cookie domain under cookie settings for each msm site...

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.