I need to create action to publish one random node from unpublished nodes of one content type. How to do this? Is there a PHP code for this?

Comments

VasyOK’s picture

I used

$nids = array(1, 2, 3, 4, 5);
$random = array_rand($nids, 1);
$node = node_load($nids[$random[0]]);
$node->status = 1;
node_save($node);

But it's doesn't work.

Maybe any "return" missing?

mitchell’s picture

Component: Miscellaneous » Rules Core
Category: task » support

Updated component.

TR’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Well, there's a "Publish content" action in D7, I don't know about D6 - and D6 is unsupported now ...