Since you are deeply in your project I see two possibilities right now:
- Site builder
Add all the required fields to your user profile, and use something like complete_profile to force completion. Maybe profile2 might help as well. Once you gathered a complete profile use rules to create a node of the content type you strive to create. Upon creation, you might want to drop the profile field contents etc., I think profil2 might be the better solution, so you don't have the to use drupals core profile, and can drop that filled profile once you don't need it, or even disallow changes after creation / hide fields of it etc.
- Developer
try to get the node fields of the node add form for your specific content type and merge them with the registration form.
function mymodule_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'user_register') {
dpm($form);
module_load_include('inc', 'node', 'node.pages');
$node_form = node_add('nodetype');
// $output = drupal_render($form);
// this copying probably has to be done in a better way, e.g. by only the fields you need.
$form['node'] = $node_form;
// register a submit handler, so you can create the node/ do validation whatsoever
$form['#submit'][] = 'mymodule_user_register_create_node';
}
}
If your node form has a file upload widget, you should add the following lines to the menu array:
'file path' => drupal_get_path('module', 'node'),
'file' => 'node.pages.inc',
submit handler:
There are probably better ways to do this, e.g. reuse the existing node submit handler, instead of mimicking it's behavior.
function mymodule_user_register_create_node($form, &$form_state) {
$node = new stdClass();
$node->type = 'nodetype';
$node->title = $form_state['values']['node']['title'];
$node->language = LANGUAGE_NONE;
$node->uid = 0; // you probably have to somehow find out the created uid from the registration and link this here
node_object_prepare($node);
$node->field_something[LANG_NONE][0]['value'] = $form_state['values']['node']['sometextfield'];
node_save($node);
}
This code is far from being ready to use (I just drafted it straight from my head, you will have to dpm() some values and see how it fits together, but the logic/ workflow is there.
extra:
look at how entity_form_submit_build_entity();
is used to see how core get's the form, form state values and creates an entity with the given input, instead of doing this by hand. Be aware that at that stage you probably have to make sure that everything required is available, which might be harder than doing that stuff in custom code in the first place.