If you go in admin/config/system/site-information and set your own path mothership will still serve page--404.tpl.php without the content.

I know you can disable the mothership's 404 page feature. But if you don't know about it... you can go crazy.

Comments

G42’s picture

I had to figure out this issue as well. I think it is similar to https://drupal.org/node/1378732. The issue stems from the base theme template.php file.

There are two sections of code that check if there is a 404 error in the header. One checks the theme's custom 404 page setting and the other does not. Here are the relevant pieces:

This one correctly checks for the theme setting

    //custom 403/404
    $headers = drupal_get_http_header();
    if(theme_get_setting('mothership_404') AND isset($headers['status']) ){
      if($headers['status'] == '404 Not Found'){
        $vars['theme_hook_suggestions'][] = 'html__404';
      }
    }

But later this one doesn't even check the theme setting

    //custom 404/404
    $headers = drupal_get_http_header();

    if (isset($headers['status'])) {
      if($headers['status'] == '404 Not Found'){
        $vars['theme_hook_suggestions'][] = 'page__404';
      }

    }

Due to the multi-site issues with the site I was working on I did not do extensive testing on how to modify the base mothership template.php and simply created a custom template.php file for my theme that would unset the variable

The only function in my custom theme's template.php

/*
  Update all the preprocess magic to fix 404 error page handling
*/
function graduate_preprocess(&$vars, $hook) {
  
    //custom 403/404
    $headers = drupal_get_http_header();
    if(theme_get_setting('mothership_404') AND isset($headers['status']) ){
      if($headers['status'] == '404 Not Found'){
        $vars['theme_hook_suggestions'][] = 'html__404';
      }
    }
    //custom 404/404
    $headers = drupal_get_http_header();

    if (isset($headers['status'])) {
      if($headers['status'] == '404 Not Found'){
        unset($vars['theme_hook_suggestions']);
      }
    }
}

This allowed Drupal's custom 404 error pages to be used.
I hope this helps someone, I tried adding the theme_get_setting('mothership_404') conditional to the second if statement but ran into errors. Hope this helps someone.

jessicachan’s picture

Thanks Strajider, this worked for me!

juagarc4’s picture

Issue summary: View changes

It worked for me too!!
A better solution can be:

Replace:

if (isset($headers['status'])) {
      if($headers['status'] == '404 Not Found'){
        unset($vars['theme_hook_suggestions']);
      }
    }

by:

 if (!theme_get_setting('mothership_404') AND isset($headers['status'])) {
    if ($headers['status'] == '404 Not Found') {
      unset($vars['theme_hook_suggestions']);
    }
  }

Thanks!!