| 1 |
$Id: README.txt,v 1.7.2.2 2008/11/21 15:10:37 kbahey Exp $ |
$Id: README.txt,v 1.7.2.3 2008/12/17 18:10:36 kbahey Exp $ |
| 2 |
|
|
| 3 |
Copyright 2005 http://2bits.com |
Copyright 2005 http://2bits.com |
| 4 |
|
|
| 47 |
<?php |
<?php |
| 48 |
global $user; |
global $user; |
| 49 |
if ($user->uid == 0) { |
if ($user->uid == 0) { |
| 50 |
print '<p>If your user account has access to this page, please <a href="/user?' . |
$output = '<p>'; |
| 51 |
drupal_get_destination() . '">log</a>.</p>'; |
$output .= t('If your user account has access to this page, please !message.', |
| 52 |
|
array('!message' => |
| 53 |
|
l('log in', 'user', array('destination' => drupal_get_destination())), |
| 54 |
|
) |
| 55 |
|
); |
| 56 |
|
$output .= '</p>'; |
| 57 |
|
print $output; |
| 58 |
} |
} |
| 59 |
?> |
?> |
| 60 |
|
|
| 61 |
That way when there's a 403 they get redirected back to the page they were trying to access. |
That way when there's a 403 they get redirected back to the page they were trying to access. |
| 62 |
The above should be better refined to fit "best practices", such as doing this in a template.php |
The above should be better refined to fit "best practices", such as doing this in a template.php |
| 63 |
rather than code stored in the database, and probably call l() or url() so it works when clean |
rather than code stored in the database. |
|
URL's are disabled. |
|
| 64 |
|
|
| 65 |
Thanks to: Andrew Berry (http://drupal.org/user/71291 deviantintegral). |
Thanks to: Andrew Berry (http://drupal.org/user/71291 deviantintegral). |
| 66 |
|
|
| 76 |
2. Go to Administer -> Build -> Modules |
2. Go to Administer -> Build -> Modules |
| 77 |
- Enable the customerror module, click on Save |
- Enable the customerror module, click on Save |
| 78 |
|
|
| 79 |
3. Configure the module: |
3. Configure Error reporting |
| 80 |
|
- Go to Administer -> Site configuration -> Error reporting |
| 81 |
|
- For 403 (access denied), enter the value: |
| 82 |
|
customerror/403 |
| 83 |
|
- For 404 (not found), enter the value: |
| 84 |
|
customerror/404 |
| 85 |
|
|
| 86 |
|
4. Configure the module: |
| 87 |
- Go to Administer -> Site configuration -> Custom error |
- Go to Administer -> Site configuration -> Custom error |
| 88 |
- Enter any title and description you want for the 404 (not found) |
- Enter any title and description you want for the 404 (not found) |
| 89 |
and 403 (access denied) pages. |
and 403 (access denied) pages. |
| 91 |
- Ensure the Enable checkbox is checked. That sets or unsets the Error |
- Ensure the Enable checkbox is checked. That sets or unsets the Error |
| 92 |
Reporting settings for you. |
Reporting settings for you. |
| 93 |
|
|
|
4. Configure Error reporting |
|
|
- Go to Administer -> Site configuration -> Error reporting |
|
|
- For 403 (access denied), enter the value: |
|
|
customerror/403 |
|
|
- For 40 (not found), enter the value: |
|
|
customerror/404 |
|
|
|
|
| 94 |
5. Test your error pages. |
5. Test your error pages. |
| 95 |
- Copy your present admin page url. |
- Copy your present admin page url. |
| 96 |
- Try to go to a non-existent Drupal page on your site. |
- Try to go to a non-existent Drupal page on your site. |