You are here

function subuser_user_register_form_submit in Subuser 7.2

Same name and namespace in other branches
  1. 8 subuser.module \subuser_user_register_form_submit()

Additional submit handler for user_register_form.

1 string reference to 'subuser_user_register_form_submit'
subuser_form_user_register_form_alter in ./subuser.module
Implements hook_form_FORM_ID_alter(): user_register_form.

File

./subuser.module, line 302
Provides primary Drupal hook implementations.

Code

function subuser_user_register_form_submit($form, &$form_state) {
  global $user;

  // If the subuser relation is to be stored then create the relation.
  if ($form_state['values']['subuser_relation']) {
    $endpoints = array(
      array(
        'entity_type' => 'user',
        'entity_id' => $form_state['user']->uid,
      ),
      array(
        'entity_type' => 'user',
        'entity_id' => $user->uid,
      ),
    );
    $relation = relation_create('subuser', $endpoints);
    relation_save($relation);
  }
}