Skip to content

Instantly share code, notes, and snippets.

@and1truong
Created June 17, 2010 08:48
Show Gist options
  • Save and1truong/441867 to your computer and use it in GitHub Desktop.
Save and1truong/441867 to your computer and use it in GitHub Desktop.
<?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