giza: Giza White Mage (Default)
[personal profile] giza
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():

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)
From: [identity profile] furahi.livejournal.com
...of user experience...
That sounds a lot like work.

(no subject)

Date: 2007-02-15 05:27 am (UTC)
From: [identity profile] giza.livejournal.com

Or professionalism. ;-)

(no subject)

Date: 2007-02-15 08:05 am (UTC)
From: [identity profile] kinkyturtle.livejournal.com
[see icon for funny look]

(no subject)

Date: 2007-02-15 04:56 pm (UTC)
From: [identity profile] furahi.livejournal.com
You say potato and I say potatoe ;P

Profile

giza: Giza White Mage (Default)
Douglas Muth

April 2012

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags