I need to create a node when a account user is created if the role of this account is "student".
First I have tried with rules, but is very complicated because I need to take a date field present in the user form and copy it in the node, so i decided to do by code, but I'm not shure it is the good way.
In a module I have put :
hook form_alter : if the form is 'user_register_form'
$form['actions']['submit']['#submit'] = 'bilan_formTools_user_register_submit';
in this function I have pasted all the original function (70 lines) : user_register_submit($form, &$form_state)
At the end I have pasted the code to create the node :
$node = new stdClass();
but I just want to know if the good way, because after that I need to modify the node created when the account is modified and the date is changing.
Thanks a lot.