So, I'm working on a Drupal site that, for reasons unknown, shows the "create content" menu item even when the user is logged out. Since I don't allow anonymous users to post on this site, clicking on that menu item gives a "permission denied" error. Not exactly the sort of user experience I want to provide.
Well, I just came up with this bit of code to fix the problem. It goes in index.php after the call to drupal_bootstrap():
Share and enjoy! (Or just give me funny looks. That works too.)
Well, I just came up with this bit of code to fix the problem. It goes in index.php after the call to drupal_bootstrap():
if (strstr($_SERVER["REQUEST_URI"], "/node/add")) {
if (empty($user->uid)) {
drupal_set_message("You must be logged in to do that");
drupal_goto("user");
}
}Share and enjoy! (Or just give me funny looks. That works too.)
(no subject)
Date: 2007-02-15 05:14 am (UTC)That sounds a lot like work.
(no subject)
Date: 2007-02-15 05:27 am (UTC)Or professionalism. ;-)
(no subject)
Date: 2007-02-15 04:56 pm (UTC)(no subject)
Date: 2007-02-15 08:05 am (UTC)