Drupal: AdSense Module - Getting access denied instead of page not found
If you noticed something weird at howforge.com, 404 file not found was missing. Instead, it was replaced by 403 access denied. The cause of this problem is exactly adsense.module. Let me show you something.
function adsense_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
’path’ => ’’,
’callback’ => ’’,
’title’ => ’’,
’access’ => user_access(’hide adsense’),
’type’ => MENU_CALLBACK,
’weight’ => 0);
}
return $items;
}
This menu hooking is totally incorrect. The empty path makes all page not found errors replaced by access denied errors. To fix this problem, I simply commented this function out. The patch is as below and also submitted at drupal.org.
Index: adsense.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/adsense/adsense.module,v
retrieving revision 1.27
diff -u -r1.27 adsense.module
--- adsense.module 11 Dec 2005 05:18:35 -0000 1.27
+++ adsense.module 4 Jan 2006 08:28:03 -0000
@@ -156,7 +156,7 @@
return $output;
}
-
+/*
function adsense_menu($may_cache) {
$items = array();
@@ -171,7 +171,7 @@
}
return $items;
}
-
+*/
function adsense_perm() {
return array (’hide adsense’);
}
UPDATE: this patch has been applied to 4.6.x and cvs.
- sugree's blog
- 1211 reads
Recent comments
2 years 11 weeks ago
2 years 15 weeks ago
2 years 16 weeks ago
2 years 16 weeks ago
2 years 17 weeks ago
2 years 19 weeks ago
2 years 19 weeks ago
2 years 19 weeks ago
2 years 19 weeks ago
2 years 20 weeks ago