Hi Folk,
Note: This is not reccomended as hacking core code is not standard development policy, so consider it just to have a general info on where Drupal code do handle/manage this and preferably use suggested other ways to modify attitude from comments below.
Here a tip for changing the "Access Denied" page in a very simple and quick way. Please backup your Database and Drupal Installation before you make change to core fles.
1 Go to INCLUDES Folder
2. and make a copy of the file common.inc
3. use copy to make change.
4. edit the file with a text editor (not WORDPAD)
5. and go to "function drupal_access_denied()"
6. go to the 3th "IF" instruction
and if you want change the TITLE
of the "ACCESS DENIED" page
change default (t('Access denied'))
to someting like: (t('Welcome Visitor'))
and then add or change the text in
$return = t ('You are not authorized to access this page.')
in someting like i.e.
$return = t ('Please register or log in to get authorized to access pages in MYSITE.')
Be carefull to save the text file not with WORDPAD Windows in order
to be sure that no additional unvisible code in saved in you common.inc file.
Finally you may upload the new common.inc file and see if it work
if you get error then there is some invisible code in your copy of the file.
Check and retry till you get your wanted results.
bye
Comments
couldn't this be done with
couldn't this be done with the locale.module? rather then hacking at a core file?
If so, making this change in the locale.mdoule would preserve your changes in the event of an update.
Everything can be done but
Well, i exactly do not know now what the local.module contains. But as from your suggestion I will give a look. At the moment my Tip for a customising the access-denied page issue was just my quick and simple way to get some personalization of a own Drupal Install. That's it.
Thank's for your Post.
Contact me for drupal projects in English, German, Italian, Drupal Hosting Support.
It works!
Hey it works!
Thanks a lot!
"Hello from Malaysia! ^^ "
Skype: ga1984
---
One can also accomplish this by creating a custom 403 error page and setting it in administer -> error reporting which would be a preferred method, as changes made to core files will be overwritten during an update or an upgrade.
@ verymisunderstood
No that is not possible.
Custom 403 pages are not available to the Anonymous user if you've disables access node content in the Permissions.
=-=
I don't see where anyone discussed content access being removed in this thread.
It does work, when access to content is indeed granted. doesn't seem that difficult to grant access to page content, so that a custom 403 would indeed work.
Either way, I would avoid altering core files as when doing so you have to make these changes over and over again, when you update/upgrade core. Limit your workload and do things the drupal way, instead of the dirty hack way.
Fully and absolute agree with
... I fully and abolute agree with VeryMisunderstood
at the time I wrote this post ( October 5, 2006 - 15:54) I was not aware of build a custom
error_page that is the best way to custom "access denied" or/and "page not found" pages.
so if you want to custom "access denied" pages go to >> administer >> site configuration >> error reporting
and insert something like: /node/(the number of your error-page node) in Default 403 page
the same procedure for field Default 404 page.
Cheers
There is nothing better then Drupal. Please contribute
ADACCS a Drupal Theme Community
Contact me for drupal projects in English, German, Italian, Drupal Hosting Support.
access deny
Changed to my new page /node10 but nothing changed
Hi, my misstake the right
Hi, my misstake the right inmput in the Error setting page must be:
node/(and the number of your Node)
example: node/1
Cheers
Share your experience with the Open Source Community
it's not only a choice but a Life Philosophy !!!
http://www.adaccs.at A CSS Documetation Project
Contact me for drupal projects in English, German, Italian, Drupal Hosting Support.
Yah what you said totally
Yah what you said totally works! Really helped me out also with content management...Thanks, great advice!
simple solution is to go to
simple solution is to go to admin/settings/error-reporting and change the access denied page to /user it wil automatically redirect you to the login page :)
see it in action at http://rentsellproperty.net
http://www.rentsellproperty.net
http://www.secgeeks.com
http://www.newskicks.com
Superb!
What an idea!
You have really made solution easy!
I guess we should think about the problem in hand than about the solution we can find!
Really nice work man!
"Access Denied" - how to change text?
hi
we do not have admin/settings/error-reporting in our admin.
could it be somewhere else?
Thanks a lot!!! Hacking or
Thanks a lot!!! Hacking or not... can't find an easier way :)
=-=
directly above your comment avoids hacking core files ; )
Or use String Override instead
Trying to do something similar, I found a neat way to change any of those hard to reach titles without and hacks.
If you install the string overrides module (http://drupal.org/project/stringoverrides), you can change any string you like. So I tried to override 'Access Denied' to something nicer.
Didn't work. But then I noticed that the String Override module features says 'Easily replace anything that's passed through t()'
So I went to my theme and found where the title is out-putted, which normally looks like this:
print $title;Wrap a t() function around it so it looks like this:
print t($title)and bosh..... it works and you can now change the main page title for any page you like.
Redirect Access Denied pages to front page
Hey.
I need to know that, is there any way to redirect the access denied pages to the front page of drupal. My front page is drupal default front page.
So, i need that when user visits the unauthorized page, s/he will be redirected to the front page.
What should i write in the Error-Reporting URL to achieve this.
example.com/
example.com/front
doesn't worked for me.
Please help!
Thanks
Jimmy
Front Page
It seems there is a module, Front Page, that handles this situation very nicely.
=-=
actually there are redirect modules that would handle this better.