<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 10pt; color: #000000'><div class="content">
<p>Regarding Drupal 6.x. Running core Drupal with og, og_user_roles and tac_lite.</p><p><br></p><p>I am dynamically creating roles and adding them to the $user object in hook_boot and hook_user('load') (and several other places).</p><p><br></p>
<p>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:<br>
</p><div class="codeblock"><code><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);"><?php<br> </span><span style="color: rgb(0, 119, 0);">global </span><span style="color: rgb(0, 0, 187);">$user</span><span style="color: rgb(0, 119, 0);">; // $user object contains correct roles for access<br> </span><span style="color: rgb(255, 128, 0);">// Got this from node.module (node_access)<br> // No matter the type, this should return us the create permission.<br> </span><span style="color: rgb(0, 0, 187);">$module </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">node_get_types</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'module'</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$type</span><span style="color: rgb(0, 119, 0);">);<br><br> if (</span><span style="color: rgb(0, 0, 187);">$module </span><span style="color: rgb(0, 119, 0);">== </span><span style="color: rgb(221, 0, 0);">'node'</span><span style="color: rgb(0, 119, 0);">) {<br> </span><span style="color: rgb(0, 0, 187);">$module </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(221, 0, 0);">'node_content'</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(255, 128, 0);">// Avoid function name collisions.<br> </span><span style="color: rgb(0, 119, 0);">}<br> // I checked $user->roles before this is called<br> </span><span style="color: rgb(0, 0, 187);">$access </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">module_invoke</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$module</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(221, 0, 0);">'access'</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(221, 0, 0);">'create'</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$type</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">$user</span><span style="color: rgb(0, 119, 0);">);<br> // and, afterwards. They are exactly what they should be to allow this<br> // this user access to this content<br> ...<br></span><span style="color: rgb(0, 0, 187);">?></span></span></code></div><br>
$access is FALSE. <br><br>What happens in module_invoke where it would override the roles in the $user object?
<p>This same exact code worked in 5.x, so I have to believe there is something that has changed in 6.x with <span style="font-weight: bold;">module_invoke() / $user</span>. Furthermore, this code worked in the initial Drupal 6.x versions, so this change, whatever it is, is rather recent.</p><p><br></p><p>Any ideas, whatsoever?</p><p><br></p><p>Thanks!</p><p><br></p><p>-ron<br></p>
</div></div></body></html>