Skip to content

Instantly share code, notes, and snippets.

@dmuth
Created January 10, 2012 04:54
Show Gist options
  • Select an option

  • Save dmuth/1587038 to your computer and use it in GitHub Desktop.

Select an option

Save dmuth/1587038 to your computer and use it in GitHub Desktop.
Drupal shows "create content" menu item to anonymous users
<?php
/**
* From my blog post at:
*
* http://www.dmuth.org/node/1201/drupal-shows-create-content-menu-item-anonymous-users
*
*/
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");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment