I am using Acquia Drupal 6.17 and the CCK that comes with it. The CCK version included in the Acquia Drupal 6.17 is // $Id: nodereference.module,v 1.138.2.60 2009/08/26 17:29:58 markuspetrux Exp $

I programmatically imported a bunch of nodes and assigned node references and they work fine. However, if I edit a node that contains node references and then try to save after editing, I get the "this post can't be referenced" error. I looked in the code for nodereference.module and I believe there is a typo that causes this problem.

On line 220 there is a comment that says: // Prevent performance hog if there are no ids to check.
Then on line 221 the code is if ($ids) {
However, based on the comment, I believe line 221 should actually be if (!$ids) { instead. When I edited nodereference.module to be this, then I could save my node without any errors.

Comments

karens’s picture

Status: Active » Fixed

You can't programmatically submit a bunch of nodes using drupal_execute because of a core bug that skips validation on all but the first one. If you are going to programmatically submit a bunch of nodes you need to use node_save(). The goal is not to find a way to surpress the errors, it is to make sure the nodes are processed correctly. The errors are an indication that the code is not working.

There is a very very very long issue in core about this bug and there is nothing we can do about it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.