function rules_action_add_node in Rules 6
Action "Add a node"
Related topics
File
- rules/
modules/ node.rules.inc, line 281 - rules integration for the node module
Code
function rules_action_add_node($author, $title, $settings) {
if (!$settings['node_access'] || node_access('create', $settings['type'], $author)) {
module_load_include('inc', 'node', 'node.pages');
$node = (object) array(
'type' => $settings['type'],
);
node_object_prepare($node);
$node->name = $author->name;
$node->uid = $author->uid;
$node->type = $settings['type'];
$node->title = $title;
return array(
'node_added' => $node,
);
}
}