Where can I change the message given to users who try to access stuff they don't have permission for?

I wan't to link to /node/add/story, and if it is an anonymous user (who can't do that) offer them a login or register screen.

thanks

I hope that's clear. I'm a bit sleepy!

Comments

styro’s picture

the custom error module?

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

geohelper’s picture

Just go into administer > settings > Error handling

Then just change the Default 403 (access denied) page to a custom node you created.

For example, I made a new page using the following...

<?php
global $user;
if ($user->uid) {
  echo 'Sorry, you do not have permission to view this page.<br /><br />';
} else {
  echo 'Please <a href="/user/login">login</a> or <a href="/user/register">register</a> to access this page.';
}
?>
Juniper-1’s picture

Hello there,

I would like to change my "Access denied" message to something more friendly, and I did go into settings and specified "node/105" in the Error handling section, specifically the Default 403 (access denied) page. The node is a custome page that I created from within my drupal installation to replace the "Access Denied" text one commonly sees to the right of the login block, before logging in.

After doing this, I still get the ol' "Access Denied" Page when I'm not logged in.

Any suggestions would be appreciated.

Cheers.

styro’s picture

have the "access content" permission turned off? If they do, they won't be able to see the error node.

If that is the case, your options would be to let them have the permission and use an access control module to stop them getting to the other stuff, or use the custom error module (http://drupal.org/project/customerror).

The advantage of the custom error module is that the error pages aren't nodes - you don't need "access content" to see them and they don't show up in searches or popular content etc.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

Juniper-1’s picture

Styro,

Thank you so much. Your advice was extremely helpful.
There was only one small tweak. Now when I log into my drupal site, the customerror page is visible after a successful log in, as opposed to "node" (Page with all blog entries). Before I installed the customerror module I saw "node"..

Is there some easy way to correct this?

Thanks again.

Juniper

styro’s picture

are you sure the front page setting is still node?

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

Juniper-1’s picture

Default front page:
(this value is listed as "node")

Error handling

Default 403 (access denied) page:
This page is displayed when the requested document is denied to the current user. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.
(I have entered "customerror/403")

Default 404 (not found) page:
This page is displayed when no other content matches the requested document. If you are not using clean URLs, specify the part after "?q=". If unsure, specify nothing.
(and this box is empty)

Any ideas?

After I log in, I see my customerror 403 page in the centre of my drupal installation. but once I click on the logo or website title.. I see the published blogs that were "promoted to front page" when they were created.

Now, the module mentioned patching core files for the 4.6.0 version to work properly. I did not do that, primarily because
1) there were only patch files included in the download for 4.6.3, not 4.6.5. (My install is 4.6.5)
2) I lack patching knowledge. Could that be the root of my problems...?

Thank you.

Juniper-1’s picture

I did some further testing.. applied different themes... no dice...

I will keep tinkering.. but any insight would be wonderful.

Cheers,

Juniper

qcanoe’s picture

Drupal 5.x newbie. Tons of posts out there - like the one above - referring to "administer > settings." Where is that? When I log in as admin and then click on the Administer link, I get tons of options, none of them called "settings." There is "Post Settings" (under "Content Management") and "User Settings" (under "User Management"), but nothing called just "settings" (and nothing about error handling). Is "settings" really a code term that really refers to something with a different name on the UI? Please advise.

Thanks.

styro’s picture

that predate Drupal 5. In Drupal 5 those settings moved to:

/admin/settings/error-reporting

or if you want to get there via the menus:

administer > site configuration > error reporting

--
Anton