Created
June 17, 2010 08:48
-
-
Save and1truong/441867 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// $Id$ | |
/** | |
* Implements hook_menu_alter(). | |
*/ | |
function w_menu_alter(&$items) { | |
foreach (node_get_types('types', NULL, TRUE) as $type) { | |
$type_url_str = str_replace('_', '-', $type->type); | |
$items['node/add/'. $type_url_str]['access callback'] = 'w_node_access'; | |
} | |
} | |
/** | |
* Custom access check for node-create pages. | |
*/ | |
function w_node_access($op, $type) { | |
static $called = FALSE; | |
if (!$called) { | |
$called = TRUE; | |
og_user_roles_init(); | |
} | |
return node_access($op, $type); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment