After using the module I noticed a problem with the css files.

More specific, I set the module to auto logout the users after 120 seconds. I login with a user account to my site and afterwards I close the window. When I open a new window after 130 seconds and visit the site, the user is auto logout (as he is supposed to be) but the page opens with no css files. If I refresh the page it reloads my site normally (with the css files of my theme).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johnennew’s picture

Can you do any further analysis of what is going on? This isn't something I am able to replicate so might be something with your setup. After the page loads with no CSS can you view source and see what CSS links are included? Are they correct? Can you switch your theme to a Drupal default one and see if it works with a core theme?

chrbak’s picture

Hello @ceng, I install the module in another site and it did worked fine, so the problem relies on the setup of the specific site I first used.

I checked the paths of the css files and are correct but I noticed that there are missing 3 css files. I have attached two source code snapshots of the page before and after the refresh. As you can see the style1.css, responsive.css and style.css are missing.

I use a subtheme and modules like Front Page..

kholloway’s picture

FYI. I am experiencing the same issue with my custom theme CSS files not loading after the initial page load after an auto-logout occurs.

if it helps to provide more information the parts that are being skipped is:

// Hide styles.css from IE8 and below.
drupal_add_css(
  drupal_get_path('theme', $GLOBALS['theme_key']) . '/css/styles.css',
  array(
    'group' => CSS_THEME,
    'browsers' => array('IE' => 'gte IE 9'),
  )
);

// Add non media-query stylesheet for IE8 and below.
drupal_add_css(
  drupal_get_path('theme', $GLOBALS['theme_key']) . '/css/no-mq.css',
  array(
    'group' => CSS_THEME,
    'browsers' => array('IE' => 'lt IE 9', '!IE' => FALSE),
  )
);

I'm not sure if it's skipping my entire css.inc file or just these but those never come through the first time. Will continue looking into what could be causing this behavior.

kholloway’s picture

I resolved the issue by making the following theme fix:

I noticed the theme css include file (which contained the code posted previously) was just inline (included) php in the template.php theme file. I moved the code to inside a THEME_preprocess_html function and this problem went away.

If you are having this problem you might want to double check where your CSS is being loaded and make sure it's correct :)

amoebanath’s picture

Status: Active » Needs review
FileSize
705 bytes

We've had this issue also. Steps to reproduce:

  • Set the autologout to something small, e.g. 60 seconds
  • Log in
  • Disable Javascript
  • Wait for just over 60 seconds
  • Reload the page

The results is that any calls to drupal_add_css which were made before autologout_init() ran are clobbered by this code:
(Specifically, the call to drupal_static_reset() )

  // We need a backup plan if JS is disabled.
  if (!$refresh_only && isset($_SESSION['autologout_last'])) {
    // If time since last access is > than the timeout + padding, log them out.
    if (($now - $_SESSION['autologout_last']) >= ($timeout + (int) $timeout_padding)) {
      _autologout_logout();

      // User has changed so force Drupal to remake decisions based on user.
      global $theme, $theme_key;
      drupal_static_reset();
      $theme = NULL;
      $theme_key = NULL;
      menu_set_custom_theme();
      drupal_theme_initialize();
      _autologout_inactivity_message();
    }

As such, this patch ensures that autologout_init() runs before any other hook_init() hook implementations (any of which may call drupal_add_css()).

In the Drupal 6 version of this module, the weight was set to 1000 (which was never reset by the Drupal 7 version in its place), which means autologout_init() runs quite late if you've upgraded. So, this issue was quite noticeable for us. It will be less noticeable for fresh installs, because the module weight will be set to 0, and the module begins with an 'a'. There is a good chance that in this case no hook_init() implementations that run before autologout_init() call drupal_add_css(), so may not be noticeable.

MrHaroldA’s picture

Status: Needs review » Needs work

The proposed solution does not fix our issue with CSS-less pages after autologout. When returning to the site after the logout period has passes, you'll end up with an unstyled page stating thaty you've been logged out due to inactivity.

This is with JS enabled, and yes; I cleared the cache ;)

At fritst I thought that it was due to the Varnish caching layer, but after disabling that it still occurs, even with the patch from #5.

JordanMagnuson’s picture

Version: 7.x-4.3 » 7.x-5.x-dev

Yep, just discovered this same issue on my site after upgrading to the 7.x-4.x version of this module.

Here's a sample page (missing proper css) after coming back from being auto logged out: http://i.imgur.com/8O8oKPM.png

Here's what the page looks like after a refresh: http://i.imgur.com/i6k77EF.png

johnennew’s picture

Version: 7.x-5.x-dev » 7.x-4.x-dev

@JordanMagnuson did you see if the solution provided by the patch in #5 fixes this for you? Do you know if you have any drupal_add_css calls in your hook_init functions?

JordanMagnuson’s picture

I'm trying the patch now.

JordanMagnuson’s picture

The patch in #5 is working for me.

DeaOm’s picture

Status: Needs work » Needs review

Is this issue still present? I can't seem to reproduce it. And if is, does the patch #5 still solve it?