By bigplanet on
I am working on a site that needs some users (employees) to create nodes for other users (clients). I have a block with my node/add form, and I have created the module below to stuff the clients UID in where the employees UID would be, but I can't get it to work. I have verified that the form alter and custom handler are being called.
I'm thinking that I am setting the values, but then Drupal is overwriting it just before it submits the values to the DB.
Can someone help me on this? How can I access the different form processing stages?
<?php
function addSR_form_service_request_node_form_alter(&$form, $form_state) {
if (arg(0) == 'user' && is_numeric(arg(1))) {
$form['#submit'][] = 'addSR_submit_function';
}
}
function addSR_submit_function($form, $form_state) {
$account = user_load(arg(1));
$form_state['values']['uid'] = $account->uid;
$form_state['values']['name'] = $account->name;
}
?>