Regarding Drupal 6.x.  Running core Drupal with og, og_user_roles and tac_lite.


I am dynamically creating roles and adding them to the $user object in hook_boot and hook_user('load') (and several other places).


The $user object contains the roles that the user needs to create content for the node $type in the example below (I have verified that). Theoretically, module_invoke below should not return false, but it is:

<?php
 
global $user; // $user object contains correct roles for access
 
// Got this from node.module (node_access)
  // No matter the type, this should return us the create permission.
   
$module = node_get_types('module', $type);

    if (
$module == 'node') {
     
$module = 'node_content'; // Avoid function name collisions.
   
}
     // I checked $user->roles before this is called
    
$access = module_invoke($module, 'access', 'create', $type, $user);
     // and, afterwards.  They are exactly what they should be to allow this
     // this user access to this content
     ...
?>

$access is FALSE.

What happens in module_invoke where it would override the roles in the $user object?

This same exact code worked in 5.x, so I have to believe there is something that has changed in 6.x with module_invoke() / $user.  Furthermore, this code worked in the initial Drupal 6.x versions, so this change, whatever it is, is rather recent.


Any ideas, whatsoever?


Thanks!


-ron