How to add a new condition to access callback function in hook_menu_alter? I need to add a new condition to access callback function for a menu path.

For it I write hook_menu_alter and redefine there new access callback function.

function mymodule_menu_alter(&amp;$items){
  $items[node/add']['access callback'] = 'mymodule_custom_callback'; 
}


And I have a question. I want this function to not overwrite previous access callback function, but add a new condition, which would be added to previous conditions for access callback.

How to do it most correctly ?

And is it possibly to do it not knowing the name of default access callback function ? For example, default access callback function for path node/add is _node_add_access().
You can call default access callback function in your custom access callback and if default access callback return TRUE, then you can check your own conditions and return TRUE/FALSE. Check example below:

function mymodule_custom_callback() {
  // If node access return TRUE.
  if (_node_add_access()) {
    // Do your processing here.
    if (condition) {
      return TRUE;
    }
    else {
      return FALSE;
    }
  }
  return FALSE;
}



  And is it possibly to do it not knowing the name of default access
  callback function ? For example, default access callback function for
  path node/add is _node_add_access().


In such cases, you can either find it by debugging (print $items['node/add']; exit;) or you can append that as an access argument and call it from your custom callback. Something like below:

function mymodule_menu_alter(&amp;$items){
  $items['node/add']['access arguments'][] = $items['node/add']['access callback'];
  $items['node/add']['access callback'] = 'mymodule_custom_callback'; 
}

function mymodule_custom_callback($function) {
  // If node access return TRUE.
  if (function_exists($function) &amp;&amp; $function()) {
    // Do your processing here.
    if (condition) {
      return TRUE;
    }
    else {
      return FALSE;
    }
  }
  return FALSE;
}