I have make two content type A & Second is B.when user update A content type node then all node of content type B should publish.so
I have used rules module
I make a rule -
After updating existing content --->in event.
Content is of type --->in Conditions .
Execute custom PHP code -->Actions
Then write php code this then get this error.

$result = db_query('SELECT n.nid, n.status, n.type FROM {node} n WHERE  n.type = :type', array(':type' => 'competition' ));
    foreach ($result as $record) { 
        $nodes =   node_load($record->nid);
        $nodes->status = 1;
        node_submit($nodes);
        node_save($nodes);
    }

Error is :

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /var/www/competition/includes/entity.inc).
Notice: Trying to get property of non-object in file_field_presave() (line 220 of /var/www/competition/modules/file/file.field.inc).
Notice: Undefined property: stdClass::$uri in file_save() (line 566 of /var/www/competition/includes/file.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1369828340 ) in drupal_write_record() (line 7136 of /var/www/competition/includes/common.inc).

The website encountered an unexpected error. Please try again later.

Comments

rahulkumar.it’s picture

Issue summary: View changes

testing

rahulkumar.it’s picture

Issue summary: View changes

testing

rahulkumar.it’s picture

Issue summary: View changes

test

TR’s picture

Category: Task » Support request
Status: Active » Closed (cannot reproduce)

This is really a support question, along the lines of "How do I do ...". Since this issue is more than 5 years old I assume I'm not going to get a reply ...

This is definitely not how I would do it - you don't need a PHP action to publish code, and you should avoid PHP actions and conditions in general.

Your error is related to a file field on your content type. You haven't described anything about your content type, and you're not filling in the file field in your PHP code, so I can't guess what the real problem is. But what you could do is use and entity query action or a VBO action to get a list of the content you want to publish, then loop over that content and publish it with the "Publish content" action.