Custom themes on Error Pages
| Project: | CustomError |
| Version: | HEAD |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
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.
| Attachment | Size |
|---|---|
| customerror.module.5.0.patch | 2.42 KB |
| customerror.module.6.0.patch | 1.79 KB |

#1
New Patches, missing
global $custom_themein the files, for overriding the default theme.#2
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
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.
#4
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.
#5
Thanks for the refactoring :-)
I did not mean that all
403pages have theadmin theme.But the default behaviour of drupal is that it uses the
admin themeon the pages havingadminin the start of thepath.Adding a couple of screenshots.
Added a temp site for d6 on my machine the
default themeispushbuttonand theadmin themeisgarland.This is what happens on the pages when accessing 404 and a 403.
#6
I'd love this feature, and the patch here doesn't apply against the current version.
#7
I too would like to see this feature applied, as I use two different themes for admin/non-admin sections.