Community Documentation

Ultimate 403 Error Page

Last updated April 21, 2011. Created by ballboy on April 21, 2011.
Log in to edit this page.

Ultimate 403 Error Page

If user isn't logged in it displays login prompt, if user is logged in and still gets a 403 then it displays a 'you are not authorised' message.

Step 1 of 2

Create a page and assign in admin/settings/error-reporting

Step 2 of 2

Add the following to the page:

<?php
global $user;
if (
$user->uid) {
    Print
"Although you are logged in you are unfortunately not authorised to view this page.";
}
if (!
$user->uid) {
    print
drupal_get_form('user_login');
}
?>

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 6.x
Audience
Designers/themers

Theming Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here