Creating node in installation profile but body field stays empty I am trying to generate nodes in my installation profile. The weird thing is that everything works except the body. First here is the code I use:

$date = new DateTime();
$node = new stdClass();
$node-&gt;type = 'article';
$node-&gt;status = 1;
$node-&gt;uid = 1;
$node-&gt;title = 'Test title';
$node-&gt;promote = 1;
$node-&gt;created = $date-&gt;getTimestamp();
$node-&gt;timestamp = $date-&gt;getTimestamp();
$node-&gt;sticky = 0;
$node-&gt;format = 3;
$node-&gt;language = LANGUAGE_NONE;
$node-&gt;teaser = '';
$node-&gt;revision = 0;
node_object_prepare($node);
$node-&gt;intro[$node-&gt;language][0]['value'] = 'introtext index';
$node-&gt;body[$node-&gt;language][0] = array(
    'value' =&gt; 'Body text test',
    'summary' =&gt; '',
    'format' =&gt; 'filtered_html',
    'safe_value' =&gt; 'Body text test'
);
node_save($node);


The weird thing is.. This code works perfect when I add it in the index.php. But when I add this exact same code in the installation profile everything works except the body(it stays empty).

I tried the next two possibilities see below:

$node-&gt;body = 'Body text test'

$node-&gt;body[$node-&gt;language][0]['value'] = 'Body text test'

I also replaced $node-&gt;language for 'und' on all possibilities.

Still I find it weird that my code works in the index.php but not in the installation profile. Does anybody have a clue what I am doing wrong or what needs to change?
I know this old, but I just came across it.  It's really difficult to know what's going on without being able to look at all of the code, but my guess would be you are trying to use 'format' => 'filtered_html' before you've define it in the .install.  In the distributions I help to maintain, we always call filter_format_save as one of the first items of business... 

http://cgit.drupalcode.org/cm_starterkit_easy/tree/cm_starterkit_easy.install#n14