Dunstan-style Error Page
Overview
This is another plugin that I used on my old site and now I’m modifying it to make it WP friendly. It’s basically the same 404 error page that Dunstan Orchard uses on his 1976design.com/blog site. Install the file to your plugins directory, activate, configure, and enjoy!
Compatibility
Wordpress Versions:
- 2.1
- 2.0
- 1.5
- In theory, it should work with 1.2.*, but it has not been tested.
Installation
- Downloaded the latest version of the plugin (below)
- Rename the downloaded file to
afdn_error_page.php - Upload to your plugins directory (typically
/wp-content/plugins/) - Activate the plugin
- Configure the plugin under Options > Error Page in the administration panel
- Find the 404.php file for the theme you are using, usually located at
/wp-content/themes/*YOUR_THEME_NAME*/404.php - Delete everything in the 404.php file and replace it with:
[php]
[/php] - Enjoy!
Download
Latest version:
Changelog
1.3.1
….
1.3
….
1.2
Got all the Akismetfeatures working. While the plugin will work without an API Key, you really should get one. All comments that are tagged as spam by Akismet are placed into an array in the WPDB. You can manage it from the regular Error Page management window. I used the Akismet Comment Spam plugin as a basis for a lot of the UI, so things should be pretty familiar.
4-22-2006 - http://dev.wp-plugins.org/browser/dunstan-error-page/tags/1.2/
1.1
Layed the foundation for Akismet spam testing. If you have a valid API key, detailed error reports will be checked against for spam. YOU DO NOT NEED AN API KEY FOR THE PLUGIN TO WORK. My name was also hardcoded in one last place, so I took care of that. There was an issue with checking the referer that would return a false negative if the actual URL wasn’t preceded with WWW, so that’s fixed. I also coded some things in a rather crappy way, so I cleaned that up. Most of the plugin is now commented, so that should help anyone try to figure out what the heck I was thinking.
4-22-2006 - http://dev.wp-plugins.org/browser/dunstan-error-page/tags/1.1/
0.82
Thanks to Ozh for the heads up on some hardcoded text that should have been dynamic and for suggesting securing the email form.
12-29-2005 - http://dev.wp-plugins.org/browser/dunstan-error-page/tags/0.82/
0.8
NOTICE: Copyright format changed from MIT to GNU GPL as of version 0.8
Embeded error page code into plugin file….if that makes sense.
12-28-2005 - http://dev.wp-plugins.org/browser/dunstan-error-page/tags/0.8/
0.7
Added functionality for redirected error pages.
8-25-2005 - http://dev.wp-plugins.org/browser/dunstan-error-page/tags/0.7/
0.5
Inital public release
6-24-2005 - http://dev.wp-plugins.org/browser/dunstan-error-page/tags/0.5/
RSS
Your instructions seem to be missing a crucial part: what to put in the 404.php file (step seven). What do I need to put in the file for this plugin to work?
Yea…that’s a critical step. I’ve fixed it, see above for the answer.
Now this is cool! It integrates nicely with the existing theme. Thanks for sharing.
Great idea - that’s a really nice plugin.
I tweaked it slightly - I didn’t want to use a table for the 404 page content, and wanted everything to display sequentially, rather than grouped like it was (it didn’t fit with my theme).
It’d be really cool if a future version let you say “display all section with line breaks between them, or preserve table structure” as an option.
Thanks Andrew - very much nicer than the standard 404 page!
If anyone happens to be trying to figure out where to get the API key*, go to your WP-Admin area and click
Plugins > Akismet Configuration … and there it is.
*the plugin asks for it and links you to wordpress.com, which has some sort of strange loop effect going on.
this version corrected my previous issue, so thanks, good work.
Warning: call_user_func_array(): First argumented is expected to be a valid callback, ‘afdn_error_page_myManagementSubpanel’ was given in /home/thesup3/public_html/wp-includes/plugin.php on line 123
If I activate the plugin I get the following error when I try to go the Manage/Error Page screen.
Warning: call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, ‘afdn_error_page_myManagementSubpanel’ was given in /home/eckernet/public_html/wp-includes/plugin.php on line 123
** Same as above for Kevin, as posted 21st February **
If I activate the plugin I get the following error when I try to go the Manage/Error Page screen.
Warning: call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, ‘afdn_error_page_myManagementSubpanel’ was given in /home/eckernet/public_html/wp-includes/plugin.php on line 123
I installed a fresh copy of WP and tested it out and didn’t get any errors. So this might take some more time to track down. My current guess is that it might be conflicting with another plugin.
Okay. I found the bug. I was adding the menu in twice. Grab the new code: http://dev.wp-plugins.org/file/dunstan-error-page/tags/1.3.1/afdn_error_page.php?format=raw
The guys a genius, I didn’t notice that
Thanks Andrew!
Hi Andrew,
I experience a strange problem.
I use WP 2.1.1 with your plugin.
It works perfectly in FireFox, but I get a standard ‘The page cannot be found’ error when using Internet Explorer 6 .
Any suggestions?
Cor
If you force a refresh while using IE6, the true error page will load. I vaguely recall a “bug” being mentioned a while back on the Apache site that said that IE would not load an error page sent by the server it was was less than so many KBs. Unfortunately, I don’t remember what version of IE and how many KBs were needed.
I also tested it on IE5, and that worked properly, which is weird.
I’ll see what else I can dig up, but that’s a start.
Thank you Andrew.
I have tried the refresh in IE6 to no avail.
I have also tried both direct load and redirect - still the same.
I have cleared files and history on IE6 - same.
You may want to test mentpro.com
Regards
Cor
Try force refreshing (Ctrl + F5).
It looks like your using Apache, so I’m not sure what the issue is.
I’ve also been testing on your site and mine.
Apache makes a note below the ErrorDocument documentation:
From httpd.apache.org:
My best recommendation is to inflate the size of the error document. But some garbage text between two comment tags and see what that does.
If that works, I’ll roll that option into the next version. Which I hope to start work on sooner rather then later.
Andrew,
Thank you for the suggestion.
I have increased the file size of 404.php to 9k. I have included into the file.
It still works fine on FireFox. IE6: After much testing, it works about 55% of the time. Where the refresh (shift F5) previously didn’t work at all, it now works after +- the third try.
If you do find anything else, would you be so kind as to inform me?
BTW, the ‘Leave A Comment’ Plugin is excellent. Would you like to share the name of the plugin?
Cor
General Note:
I just added a donation button on the side bar (to the right), so if you *really* like my plugins (and/or me) you might consider making a donation. I’ve been spending more and more time writing and supporting plugins. I’m a college student (3rd year Elect. Eng.) and really only do this programming thing on the side for the love of it.
Cor,
Not quite sure what plugin your talking about (I use quite a few). You can view all the plugins I use at http://www.andrewferguson.net/plugins/
Recently spammers have been using this plugin to send me gobs of “Quick Error Report” emails…ideas to stop this??? ….other than removing the plugin?
Kevin,
I think your best bet would be to disable the quick error report part. There are several ways you could do it, but the easiest and cleanest is to just remove lines 395 to 403:
[html]
Quick error report
…
[/html]
I see what else I can do for the next version.
Hi Andrew really a nice job.
Just one thing: when i receive the Quick error report email the field referrer and bad page are empty.
I’ve done everything you said in your installation tips, but nothing happens…
Enrico,
Can you give me some more details:
What version of WordPress?
What version of Dunstan-style Error Page?
What server are you using (Apache? IIS?) and what version, if known?
Also, what settings are you using for the Dunstan-style Error Page?
Ok Andrew!
I am using Wp 2.1.2, Error Page v1.3.1, Apache 1.3.37.
These are the options (I’ve localized the php file so I have to retranslate the terms, sorry):
Check update: yes.
404 mode: redirect
Thanks very much for your patience!
Enrico
I’m trying to use this plug-in for a newly created site, which I’ve used previously for my own site, but this time when it is enabled I simply get a blank page when I try to access my site.
I tried running through the php at the command line and I got this:
PHP Parse error: syntax error, unexpected $end in …./afdn_error_page.php on line 503
WordPress 2.1.2 with Dunstan-style 1.3.1 on apache
I have a couple questions you may be able to help with…
I have modded this plugin just a little bit to fit my theme/layout and I’ve also made it so that for the quick submit form that the name and email text boxes are there. In both forms, when you submit the email comes from basically my server, so its this abnormal email address. How do I make it so that the name and email address that they entered goes in that place? So that if Bob Somebody submits those forms, it says that it is from Bob Somebody and not kahil@yadayadayadayada, etc.
Also, how do I make it so that the name and email boxes are required before the email is sent?
Thank you
Geoff,
I’m not sure what the error is. Try downloading the plugin again and make sure you download it from the tag and not the trunk.
Kahil,
Mostly as an FYI, the whole point of having the “quick error report” was so that the user didn’t have to enter any information in if they didn’t want to.
In any event, you’ll want to modify a couple of lines. Start with line 282:
[php]
mail(get_option(’admin_email’), ‘['.get_option("blogname").'] 404 Quick Error Report’, $message);
[/php]
Modify it to:
[php]
$headers = ‘From: ‘.$_POST["name"].’ < '.$_POST["email"].'>‘ . “\r\n” .
mail(get_option(’admin_email’), ‘['.get_option("blogname").'] 404 Quick Error Report’, $message, $headers);
[/php]
…adding the $headers variable and then referencing at the end of the mail() function.
You’re also going to want to do the same thing with line 309, modifying it to:
[php]
$headers = ‘From: ‘.$_POST["name"].’ < '.$_POST["email"].'>‘ . “\r\n” .
mail(get_option(’admin_email’), ‘['.get_option("blogname").'] 404 Error Report’, $message, $headers);
[/php]
Checking to make sure the name and email boxes have been filled before the email is sent can be accomplished a few different ways. The easiest way would probably be way to use some Javascript, http://www.thesitewizard.com/archive/validation.shtml is a good place to start.
Hi Andrew, Ive just installed the plugin and changed the 404.php file like it says in the instructions, activated the plugin and added the akismet API key. However I didnt understand one thing in the Options.
“If you don’t have access to your Apache config file or .htaccess file, of if you don’t use Apache, you can use GET tags to send the information to the script. The tags are named “referer” and “requested”.
The error page shows up as expected for a 404 page, the form, the last 5 blog entries, quick error report etc are all there, but when i send an email thru quick form or when i click on quick error report, im not receiving any email at the blog admin address.
Thanks for you help
PS: i use WP 2.1.2. K2/ 3 column K2
Andrew: Thanks for the great plugin. One question: is there any way to prevent the reporting of e-mail addresses as bad pages? I get a bunch of spam and all of them report a bad e-mail address that doesn’t exist anywhere on my site - I don’t post e-mail addresses at all. If there were some way to black any 404 Error report that reports an e-mail address as the bad page, that would be great. Thanks! -Carlton Bale
ikram,
If your error page is loading, you don’t need to worry about the Apache option. As for your email issue, it’s probably a server configuration problem.
Carlton,
You could do a quick filter check and match against “mailto” or something like that. That’s interesting that you’re getting those kind of error reports. Can you give me any more details?
Andrew,
I’ve posted the contents of several of the 404 error reports that are getting through as well as one that was caught by Akismet. Please let me know when you’ve downloaded the file so I can delete it.
http://www.carltonbale.com/hosted/404_error_report.zip
I disabled the plugin because of the all the messages I’m getting and because there are e-mail address cc’d on some of them. I’m afraid they might be valid and copied on spam messages.
Carlton,
I downloaded the file, however there’s really not anything I can do with it. The plugin checks the contents against Akismet. Akismet is the one that actually determines if the report is spam or not.
I’m getting this strange error:
Warning: unserialize() expects parameter 1 to be string, array given in /public_html/wp-content/plugins/afdn_error_page.php on line 155
Fraser,
I do know about the bug and it will be fixed in the next version. School just got out and I’m on my way back to Seattle, so I’m not really in the coding mood right now.
I’ll try to get the next release out soon though.
Hello Andrew,
Great Plug-in. I had minor problems but just reading the comments