You are here

function content_profile_registration_user_register_validate in Content Profile 6

Validates the user registration form

1 string reference to 'content_profile_registration_user_register_validate'
content_profile_registration_add_profile_form in modules/content_profile_registration.module
Adds in the profile form of the given content type to the registration form

File

modules/content_profile_registration.module, line 202
Allows exposure and processing of content_profile node fields at user registration

Code

function content_profile_registration_user_register_validate($form, &$form_state) {
  require_once drupal_get_path('module', 'node') . '/node.pages.inc';
  foreach ($form['#content_profile_registration_use_types'] as $type => $typename) {
    $node = (object) $form_state['values'];
    $node->type = $type;
    node_object_prepare($node);

    // Make sure there is no user name so we can node_validate
    unset($node->name);
    if (!in_array('other', content_profile_get_settings($type, 'registration_hide'))) {
      node_validate($node, $form);
    }
    elseif (module_exists('content')) {
      content_validate($node, $form);
    }
    $form_state['content_profile_registration'][$type]['node'] = $node;
  }

  // Remove our added values
  foreach ($form['#content_profile_weights'] as $key => $weight) {
    _content_profile_registration_remove_values($key, $form[$key], $form_state);
  }
}