Drupal 6 – Wrong theme on 403 page

In Drupal 6, we can configure the 404 Page not found and 403 Access denied urls @ admin/settings/error-reporting. Everything seems works fine except the 403 Access denied page will use the Administration theme. If you want to apply the site theme on it, the following patch could help.
theme403fix-759836.patch

You can also modified the code manually.
<drupal>/modules/system/system.module

function system_init() {
  /* Replace the following 2 lines
  // Use the administrative theme if the user is looking at a page in the admin/* path.
  if (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'))) {
  */
  // Use the administrative theme if the user is looking at a page in the admin/* path, and they have permissions to that path.
  $menu_item = menu_get_item($_GET['q']);
  if ($menu_item['access'] && (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit')))) {
     global $custom_theme;
     $custom_theme = variable_get('admin_theme', '0');
     drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
...

 

Done =)

Reference: Wrong theme on 403 error

One thought on “Drupal 6 – Wrong theme on 403 page”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.