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.

Content not displaying for logged in user

August 03, 2009 10:39am

Subscribe [3]
  • #1 / Aug 03, 2009 10:39am

    ak4mc

    429 posts

    This could be a longshot but this comes closer to what I’ve been encountering since upgrading to 1.6.8 than anything else in this section so I’ll ask here (previous thread, since separated out—thanks, moderator) to start.

    I have the single-entry pages in one of my weblogs set up to show extended content only to logged-in users. The entries in this weblog are subject to repeated editing as I add content to them, and when I want to add content I prefer to view the page as it appears on the site, to help keep track of what I’ve already written and guide me in additional writing.

    Since the last upgrade I’ve had the system refuse to show me the extended content twice now, despite every other aspect of my site recognizing me as logged-in. The first time I got access to the extended content easily, but this morning it was much more stubborn and I ended up having to delete cookies in my browser altogether before it would let me see the content.

    Again, all other aspects of the site that are available only to logged-in users (back-end, privileged comment form, etc.) have been working perfectly, only this one thing is giving me trouble.

    In every case where I’m filtering for logged-in vs. not, I use the simple conditional, { if logged_in }

    Has anyone else been noticing an intermittent problem with this conditional on particular content pages, or is it just me?

    Update: Additional info: The actual code on the template in question:

    {if extended}
      {if logged_in}
    {extended}
      {/if}<!-- logged_in -->
      {if logged_out}
    <hr size=0><span><b><i>The rest of this page's content is available only to registered users. If you are registered, <a href="http://{path=member_trigger/login}"><b>log in here</b></a></span>.<span>If you are not registered you may apply <a href="http://mcgeheezone.com/index.php/pages/registration/">here</a>.</i></b></span>
      {/if}<!-- logged_out -->
     {/if}<!-- extended -->

    It’s just now occurred to me I could simplify that by using { if:else } instead of a whole separate conditional tag, but would that affect this behavior?

    [Mod edit: split from bug report]

  • #2 / Aug 03, 2009 11:15am

    Sue Crocker

    26054 posts

    Since the last upgrade I’ve had the system refuse to show me the extended content twice now, despite every other aspect of my site recognizing me as logged-in. The first time I got access to the extended content easily, but this morning it was much more stubborn and I ended up having to delete cookies in my browser altogether before it would let me see the content.

    Kevin, might it be a www. versus non-www. version of the site?

    It depends on how you have your cookies set up.

    Let’s make sure that isn’t the issue before exploring your if construct.

    Here’s more information: EEDocs:// Cookie Settings - look at the cookie domain info.

    Does that help?

  • #3 / Aug 03, 2009 11:19am

    Derek Jones

    7561 posts

    Hey Kevin, the bug you replied to has been present for years, so it doesn’t seem to be related to the issue you’re having now.  If Sue’s suggestion does not solve things (I had my window open while she was replying), can you try using the following?

    {if extended != ''}
        {if logged_in}
            {extended}
        {/if}
    
        {if logged_out}
            <hr size=0><span><b><i>The rest of this page's content is available only to registered users. If you are registered, <a href="http://{path=member_trigger/login}"><b>log in here</b></a></span>.<span>If you are not registered you may apply <a href="http://mcgeheezone.com/index.php/pages/registration/">here</a>.</i></b></span>
        {/if}
    {/if}
  • #4 / Aug 03, 2009 11:37am

    ak4mc

    429 posts

    Kevin, might it be a www. versus non-www. version of the site?

    It depends on how you have your cookies set up.

    I’ve had my cookie settings as “.mcgeheezone.com” for years. It was one of the first things I learned from these forums. 😊

    Hey Kevin, the bug you replied to has been present for years, so it doesn’t seem to be related to the issue you’re having now.  If Sue’s suggestion does not solve things (I had my window open while she was replying), can you try using the following?

    {if extended != ''}
        {if logged_in}
            {extended}
        {/if}
    
        {if logged_out}
            <hr size=0><span><b><i>The rest of this page's content is available only to registered users. If you are registered, <a href="http://{path=member_trigger/login}"><b>log in here</b></a></span>.<span>If you are not registered you may apply <a href="http://mcgeheezone.com/index.php/pages/registration/">here</a>.</i></b></span>
        {/if}
    {/if}

    I will do that (add != “” to the { extended } tag)—in fact on another template I made that exact change yesterday and I’m not sure what inspired me to change it from how it reads in this template.

    Thanks!

    Edited to add: Is there a wiki or something that might explain the difference, for the benefit of others who might encounter this or something like it?

  • #5 / Aug 03, 2009 5:05pm

    Ingmar

    29245 posts

    Hm, you lost me a bit here: explain what difference, exactly? Of course there’s alawys the Wiki...

    That said, it seems to be working fine now? Or do you still need assistance with this issue?

  • #6 / Aug 03, 2009 5:28pm

    Derek Jones

    7561 posts

    Basically all I did is change:

    {if extended}

    to

    {if extended == ''}

    The latter is a more explicit conditional, and is the preferred way of using the conditionals.  The “shorthand” syntax is still around from the early days when conditionals were first added to ExpressionEngine.  Some circumstances can arise where the parser will not catch the intention of nested shorthand conditionals, so I just wanted to eliminate that as a possibility.

  • #7 / Aug 03, 2009 6:31pm

    ak4mc

    429 posts

    What Derek said. Thanks all.

  • #8 / Aug 03, 2009 7:41pm

    Greg Aker

    6022 posts

    I’m glad that got you squared away.  Don’t hesitate to start a new thread if anything else comes up!

    -greg

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

ExpressionEngine News!

#eecms, #events, #releases