SOLUZIONE:
nella riga:
$form_state['values']['taxonomy[1]'] = '2';
c'era un errore e la sintassi giusta e'
$form_state['values']['taxonomy'][1] = 2;
quindi per creare un topic in automatico in un determinato forum il codice e':
// Create a new topic
$form_state = array();
module_load_include('inc', 'node', 'node.pages');
$node = array('type' => 'forum');
$form_state['values']['title'] = 'My topic';
// l'id del forum
$form_state['values']['taxonomy'][1] = 2;
$form_state['values']['body'] = 'This is the body text!';
// myname deve essere sostituito da un utente valido
$form_state['values']['name'] = 'myname';
$form_state['values']['op'] = t('Save');
drupal_execute('forum_node_form', $form_state, (object)$node);
vorrei creare topic in automatico in un determinato forum.
ho provato modificando il codice sotto riportato ma mi da errore
// Create a new node
$form_state = array();
module_load_include('inc', 'node', 'node.pages');
$node = array('type' => 'story');
$form_state['values']['title'] = 'My node';
$form_state['values']['body'] = 'This is the body text!';
$form_state['values']['name'] = 'robo-user';
$form_state['values']['op'] = t('Save');
drupal_execute('story_node_form', $form_state, (object)$node);
ovviamente al posto di story ho sostituito forum e poi nelle righe ho aggiunto:
$form_state['values']['taxonomy[1]'] = '2';
in modo da metterlo nel forum desiderato.
qualcuno mi puo' aiutare?
Grazie, scialo!
e' sempre un piacer aiutare la comunita'