Session Expiring

Good day to all. This is a post regarding the subject line for C5 8.5.9 - yes it is a legacy version but to date has worked fine for years.

Here is the issue; our client wanted to make some changes to their existing system (they do not want to move to V9 yet). One of the changes was a sticky menu which we have crafted and created a fork of the autonav block and edited it to meet our needs, which works fine.

To make the menu editable in the backend we added this code (I believe we got this from a snippet by Andrew or perhaps a community post):

CODE START

      <?php

        $pageObject = Page::getCurrentPage();

        $po = new Permissions($pageObject);

        if ($po->canWrite()){?>

        <div style="width:100%;height:49px;display:block;clear:both"></div>

      <?php }?>

CODE END

Everything works perfectly except for when we login to edit the site. When we enable Chrome Dev Tools, we get a “Session Timeout” after a minute or so, when we try to add/edit a block.

If we remove the above code, we cannot edit the navbar (okay for validation/verification that the above code causes the problem) but we do not get a Session Timeout.

Can anyone suggest what we are missing?

When using Chrome Dev tools, is this causing the user agent string to be changed? If so, then you might want to head over to index.php/dashboard/system/registration/automated_logout and turn off the “log out if the browser’s user agent changes” and perhaps anything else on that dashboard page you think might be an issue.

I’m not sure where you’re outputting that div tag. Is is possible that it’s being output before the https headers, such that the session/cookie info isn’t being sent properly?