1

Currently I maintain 10 different Drupal 7 web sites. They were designed and built by 3 different developers. These sites are running on 3 different platform types. Some are on a dedicated server, some on a VPS server and some on Pantheon. The dedicated and VPS servers are running Apache 2 and Pantheon uses Nginx. They are on various versions of the Drupal core, between 7.43 - 7.56.

All of these sites are experiencing the same issue, at some point the main navigation menu which displays on all the site pages just stops displaying. When this happens there are no errors in the Apache or Drupal logs.

On the dedicated server and the VPS servers clearing the Drupal cache (sometimes more than once) will bring the menus back. On the Pantheon servers, clearing the Drupal cache (even multiple times) does not work. The only way to do it is to clear the cache for the site in the Pantheon dashboard for that particular site.

The only common things between these sites are:

  • There is nothing "special" about these menus. They were all designed using the standard Drupal utility in the Structure menu
  • They are all sub-themed using the Drupal Bootstrap 3 as the base theme, currently at 7x-3.13

Google hasn't helped so I'm wondering if anyone has seen this error and if so, where I can start looking to correct the issue.

2

Last time I encountered such thing, it was on Drupal 8. The culprit was caching. In a gist, if the page was viewed by a user who doesn't have access to that menu and that result gets cached, the page will be served from cache (without that menu) until the cache is cleared. Might want to disable page caching, then block caching, in admin to verify this. If you have any other caching mechanisms, try disabling those too. A good indicator that this may be the case is the fact that you need to clear an external cache for one of your setups.

Another culprit would be template-side logic (template.php or directly on the templates themselves). Since you're using D7, it's relatively easy to sneak in PHP into templates. You might want to review your templates for this.

Lastly... there's JS and CSS. You might want to do a View Source to see if the markup is actually there, but just removed by JS or hidden by CSS. Due to Drupal's steep learning curve, it's very tempting to just do everything in JS and CSS. Also, if the menu is dynamically generated or enhanced by a script, a broken script might have interfered with that generation/enhancement.

0

The answer to this turned out to be unnecessary code.

The variable $primary_nav is created when the Bootstrap theme is loaded. So when the cache is cleared it removes the initialized variable which then fails the If statement. The variable is initialized when the site is reloaded which I believe is what the Pantheon "Clear Caches" button does.

Since the If statement was not necessary (we're not using Bootstrap menus) removing it cleared up the issue.

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.