Populating the body field on new nodes

Events happening in the community are now at Drupal community events on www.drupal.org.
estimi's picture

Hello,

I'm using the "Add new content" action to create three different nodes based on the information provided during the creation of another node. Unfortunately, i'm not able to populate the "Body" field of the new nodes. I'm only able to set their title and populate CCK fields. Is this a bug? A lacking feature? Any idea on how to fix this?

Thanks in advance, guys.

Comments

use custom php

rv0's picture

use custom php snippet

$new_content->body = 'the body';
return array("content" => $content);

Where should i put that PHP

estimi's picture

Where should i put that PHP snippet? Should i build a new action? If so, how can i do that?

if you have php filter

rv0's picture

if you have php filter enabled (in admin/build/modules), you should be able to make a custom php action.

tried this but it didn't work

craigritchie's picture

the body of my new node wasn't populated.

  1. After My "Create an entity" action (where I populate the title and author)

  2. I created an execute php code action with:

    <?php
    $new_X_node
    ->body = 'the body';
    $new_X_node->field-tag1 = 'test1';
    $new_X_node->field-tag2 = 'test2';
    $new_X_node->field-tag3 = 'test3';
    return array(
    "content" => $content);
    ?>

Also, first tried it without my term fields and it didn't work either way.

Could you give it some more thought? I'm sure your right, but is there a glitch in this code? Something missing?

x

craigritchie's picture

x

DefaultTextForNode

francewhoa's picture

The following module is able to do that. Maybe some of its code could be recycle. http://drupal.org/project/DefaultTextForNode

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: