ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

if_logged in pulling random user info when not logged in

May 11, 2011 12:18pm

Subscribe [3]
  • #1 / May 11, 2011 12:18pm

    Pat Brumfield

    37 posts

    I have a site currently in development, and am having issues getting {if logged_in} and {if logged_out} working. i initially discovered the error on a more complex template, but i created a simple test template which doesn’t work either. the code in my template is:

    {if logged_in}
    Welcome back, {screen_name}
    {/if}

    when logged in to the control panel, this actually works correctly, but if i’m not logged in to the control panel, it pulls the screen_name of another user. i have 3422 members in my system, and the screen_name it always pulls is member_id 1735. none of these members have access to this dev site or have logged in themselves.

    i’m on v2.1.3 and can provide any other details if necessary to help resolve this issue.

    thanks in advance.

  • #2 / May 12, 2011 12:54am

    Brandon Jones

    5500 posts

    Hi Pat,

    Have you tried {logged_in_screen_name} instead? Are you using any template caching? Try disabling it if so and clearing all caches.

  • #3 / May 12, 2011 8:44pm

    Pat Brumfield

    37 posts

    Hi Brandon,

    I just tried {logged_in_screen_name}, although that just returned the screen_name of the obscure member_id 1735. i’m not using template caching, and cleared all other caches, still getting the same results above. I tried the test page on a browser that i hardly use and has never been logged in to the site, and the results are also the same as above. For whatever reason, it seems like the {if logged_in} command is completely ignored. and my template is really as simple as the code snippet in my initial post.

    What else can i do to troubleshoot this issue? I’ve turned on php errors, template debugging and the profiler, all returning nothing that I can see as any clues regarding this issue…

  • #4 / May 13, 2011 2:21pm

    Sue Crocker

    26054 posts

    Hi, Pat. Is this on a local install, or is it somewhere we can take a look?

    If this were my site, some other things I’d try:

    Turn off extensions globally. Create a VERY simple script with nothing more than just enough of the if logged_in code to get going. I’d also manually clear my cookies for that particular site and test again.

  • #5 / May 13, 2011 2:27pm

    Pat Brumfield

    37 posts

    Hi Sue,

    This site is in development, you can view it here: http://72.10.49.53/ . I created a test template at http://72.10.49.53/test/head/ which is comprised only of the following code:

    {if logged_in} You are logged in, {logged_in_screen_name}. {if:else} Please log in. {/if}

    And you can see the results at the link above. I have disabled all extensions, cleared cookies for the site locally and cleared EE’s cache. I have no idea what else to do!

  • #6 / May 13, 2011 3:55pm

    Brandon Jones

    5500 posts

    Hmm, that template is showing that I’m logged in as well, which I obviously shouldn’t be. I still suspect some sort of caching is going on. Try deleting the contents of system/expressionengine/cache (except for index.html) via the file system (FTP for example).

    If that doesn’t work, try a build update to the latest build of 2.1.3, or even better, go ahead and update to 2.1.5. Either way a fresh set of files might be in order here.

  • #7 / May 13, 2011 4:07pm

    Pat Brumfield

    37 posts

    I tried deleting the cache via FTP, which didn’t change the results of that page.

    One thing i didn’t mention above is that we migrated the 3000+ members via a sql script from a different system. could we have tweaked anything in the exp_members table or exp_member_data that would force this member to always show up as logged_in? everything looks fine via the CP, but there’s obviously something going on somewhere…

    thanks again

  • #8 / May 13, 2011 4:16pm

    Brandon Jones

    5500 posts

    Aha! Yes, a bad import could result in some pretty unpredictable behavior. I’d try a fresh installation of EE, make sure that works normally, and then import members using the Member XML Import to be sure everything is imported properly. Keep us posted!

  • #9 / May 13, 2011 4:19pm

    Pat Brumfield

    37 posts

    ah i didn’t even know that member xml import feature existed! would have been better than creating the script ourselves.

    any tips on migrating all of the channels/entries/content that we’ve already input into this site into the fresh one upon re-install? also, would you recommend going with 2.1.5 or sticking with stable 2.1.3?

  • #10 / May 13, 2011 4:28pm

    Brandon Jones

    5500 posts

    If I were starting fresh I’d go with the 2.1.5 beta, which will go stable next month. However, if you’re going to try transplanting the channel entries from one to the other, it’d be better for them to be on the same version.

    The good news is that the channel-related tables don’t really interact much with the member-related tables, so if you’re careful you *should* be able to migrate fields and entries over with little pain. Just be sure to backup and test often each step of the way. Will definitely leave this open for you, so keep us posted.

  • #11 / May 25, 2011 4:16am

    Pat Brumfield

    37 posts

    Just wanted to post a quick note of thanks. I got the site re-installed and all of the entries & channel settings migrated over without issue. Cheers!

  • #12 / May 25, 2011 1:08pm

    Sue Crocker

    26054 posts

    Glad Brandon was able to help. Don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases