[development] modify permissions using hook_menu_alter()

Lluís enboig at gmail.com
Tue Apr 28 14:21:30 UTC 2009


I am developing a module which will allow users to post certain
content-types after 30 days of being registered.
I think this is achieved using hook_menu_alter(); but my code freezes
drupal with a white screen.

Whats is missing in my code?

function wu_menu_alter(&$menu) {
  foreach (node_get_types('types', NULL, TRUE) as $type) {
    $type_url_str = str_replace('_', '-', $type->type);
    $menu['node/add/'.$type_url_str]['access callback'] = 'wu_role_access';
    $menu['node/add/'.$type_url_str]['access arguments'] =
array('create', $type->type);
  }
}

function wu_role_access($a='',$b='',$c='',$d='',$e='') {
//  echo "**************"; //if uncommented this is displayed
  return true; //when it works I will implement the rest of the function
}


-- 
*La vida és com una taronja, que esperes a exprimir-la?
*Si creus que l'educació és cara, prova la ignorància.
*La vida és com una moneda, la pots gastar en el que vulguis però
només una vegada.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.


More information about the development mailing list