Custom themes on Error Pages

deplifer - July 4, 2008 - 15:02
Project:CustomError
Version:HEAD
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

One should be able to have different themes or have the default theme on the error pages.

It seems strange when you have an admin theme, and different system theme, when some anonymous or authenticated users try to access an admin page which they have no access too, and get a different theme than the one they are currently using.
Since the system will set the admin theme as default on every path that has /admin/* path.

You can see the difference when trying to access an drupal site on a 404 or 403 page on local site which has 2 different theme for the admin and system.

I have added 2 patch files which adds the option to add a theme for each error_page, one is for drupal 6.x and the other id drupal 5.x.

AttachmentSize
customerror.module.5.0.patch2.42 KB
customerror.module.6.0.patch1.79 KB

#1

deplifer - July 4, 2008 - 15:26

New Patches, missing global $custom_theme in the files, for overriding the default theme.

AttachmentSize
customerror.module.6.0.patch 1.78 KB
customerror.module.5.0.patch 2.45 KB

#2

kbahey - July 4, 2008 - 16:28
Status:active» needs work

Did you test this?

  $custom_theme = variable_get('customerror_' . $error_code . '_theme', ($error_code == 403 ? variable_get('admin_theme', 0) : 0));
  if (!empty($theme)) {
    $custom_theme = $theme;

How is the above code supposed to work? Who will set the variable $theme?

Also, please do not use tabs and revise the code style to conform with Drupal's code style guidelines.

#3

deplifer - July 5, 2008 - 01:09

Sorry a typo in the patch it should read>>

  $theme = variable_get('customerror_' . $error_code . '_theme', ($error_code == 403 ? variable_get('admin_theme', 0) : 0));
  if (!empty($theme)) {
    $custom_theme = $theme;
  }

For the 5.0 patch the 6.0 patch is as it shoudl be yes teste both v6 and v5 on drupal 6 an5 respectively.

Essentially if system default is selected for both do nothing which resulting in use of the "admin theme" for 403 pages. And the system theme for 404 pages.

AttachmentSize
customerror.module.5.0.patch 2.44 KB

#4

kbahey - July 5, 2008 - 02:45
Status:needs work» needs review

Why should the 403 have the admin theme by default? This is not backwards compatible with the existing behavior and can be confusing and even ugly for sites that have a nice custom theme but use garland or plain zen for admin.

Also, the code is obscure, which means it is not easy to maintain.

I refactored the D5 version in the attached. Please review and test.

AttachmentSize
customerror.patch 3.06 KB

#5

deplifer - July 5, 2008 - 11:13

Thanks for the refactoring :-)

I did not mean that all 403 pages have the admin theme .

But the default behaviour of drupal is that it uses the admin theme on the pages having admin in the start of the path.

Adding a couple of screenshots.
Added a temp site for d6 on my machine the default theme is pushbutton and the admin theme is garland.

This is what happens on the pages when accessing 404 and a 403.

AttachmentSize
403.png 107.49 KB
404.png 109.17 KB

#6

Kyle Skrinak - August 4, 2009 - 16:11

I'd love this feature, and the patch here doesn't apply against the current version.

#7

2farnorth - August 18, 2009 - 18:51

I too would like to see this feature applied, as I use two different themes for admin/non-admin sections.

 
 

Drupal is a registered trademark of Dries Buytaert.