4

On occasion, CiviCRM produces an error page like this (for example, when someone tries to visit a contribution page that has since been disabled):

CiviCRM error page: Sorry but we are not able to provide this at the moment. The page you requested is currently unavailable.

How can I make sure that this shows up in the site's theme instead of a blank white, unfriendly, actually-rather-scary page?

BONUS FOLLOWUP: would it be possible to set up a redirect setting for specific disabled pages, to forward them to a live page, or a more descriptive message?

4

you can override (not recommended):

templates/CRM/common/fatal.tpl

or set your custom error template here:

http://d46.demo.civicrm.org/civicrm/admin/setting/debug?reset=1

CiviCRM Error Settings / Handler

You can also specify a different error handler in that setting

  • 1
    Thanks, Lobo. That fatal.tpl template does not get pulled into the Drupal theme (I see that there is some logic related to Joomla and Wordpress, so perhaps it does get pulled into the theme on those CMS's). I get that I can override the template with a custom version, but how do I get that template pulled into the theme? – Laryn - CEDC.org May 14 '15 at 16:43
  • 2
    You will need to do so via the custom fatal error handler. The main reason civi does not do it, is so it can display errors even if there is a fatal error due to some CMS issue / bootstrapping. There have been cases where the fatal error handler was stuck in an infinite loop, hence the radically simple, yet super ugly fatal page – Donald Lobo May 14 '15 at 18:08
  • Would it be a bad idea to bootstrap Drupal within the fatal.tpl template? Or is there a default PHP error-handling file I can use as a base? – Laryn - CEDC.org May 14 '15 at 18:25
  • I dont think so, especially once you have a working system. – Donald Lobo May 15 '15 at 1:10
  • As of 4.7 the 'Fatal error template' setting doesn't exist, in favour of using the 'standard' approach to overriding templates. – John May 23 '16 at 9:57
3

Another (simpler) option that comes from a slightly different angle -- set up a Page Redirect using Eileen's extension so the user doesn't see the error message at all. This extension redirects all traffic from disabled contribution pages to a default contribution page (which you specify). So if you have a disabled customized donate page that you used temporarily, you can redirect anyone who comes to that page to the default live donate page, for example.

How to use:

  1. Install as usual for CiviCRM Extensions
  2. Visit civicrm/admin/setting/customredirect and enter the ID of the contribution page you'd like to redirect to.
2

As of 4.7 there is no more 'Fatal Error Template' setting. See https://issues.civicrm.org/jira/browse/CRM-16478

You can instead use the standard approach to overriding template files as described here: http://wiki.civicrm.org/confluence/display/CRMDOC/Theming+CiviCRM

The custom template directory can be set in: CiviCRM > Administer > System settings > Directories.

If your custom directory was called 'customtemplates' then to override the fatal template you would upload your new template file to: ...customtemplates/CRM/common/fatal.tpl

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.