A user found this in XML sitemap. I use hook_node_save() to 'index' nodes as sitemap links and I call node_access('view', $node, drupal_anonymous_user()) in order to check if the node is accessible to anonymous user. The problem is that for new nodes, in node_save(), hook_node_save() is invoked before node_access_acquire_grants(), so the value of node_access() is not correct.

Comments

Dave Reid’s picture

webflo’s picture

joelstein’s picture

Component: node.module » ajax system
Issue summary: View changes

A workaround for anyone experiencing this is to simply reset the node_access cache in a custom module:

/**
 * Implements hook_node_insert().
 */
function mymodule_node_insert($node) {
  drupal_static_reset('node_access');
}