We have several nodes that serve as open job postings which need to "open" and "close" on specific dates. In order to accomplish this, we publish and unpublish them accordingly.
We have a query (based on publish unpublished node programmatically) that successfully updates both the
node table and the
$result = db_query('update node n JOIN field_data_field_jobs_date d ON d.entity_id = n.nid and d.revision_id = n.vid JOIN node_revision r ON n.nid = r.nid and n.vid = r.vid # Update the node_revision table SET r.status = IF( ( CURDATE() >= d.field_jobs_date_value AND CURDATE() <= d.field_jobs_date_value2 ),1,0 ), # Update the node table n.status = IF( ( CURDATE() >= d.field_jobs_date_value AND CURDATE() <= d.field_jobs_date_value2 ),1,0 ) # Only update our custom content type WHERE n.type = \'job_posting\'');
This successfully updates the node status and node revision status in the database.
However, once a node has been published through this method, anonymous users still cannot see it (and are presented access denied if given a direct link to the node).
We have to manually edit each node and hit the save button for the published status to "take." This leads me to believe that we are omitting some sort of call to node access or something similar that updates the permissions on the node appropriately.
Any ideas besides the status field that may be preventing anonymous users from seeing programatically published nodes?