function og_register_form_user_register_form_alter in Organic groups 7
Implement hook_form_FORM_ID_alter().
Get all the groups that should appear in the user registration, and if they exist, attach the user's field to the form.
File
- og_register/
og_register.module, line 20 - Allow subscribing to groups during the user registration.
Code
function og_register_form_user_register_form_alter(&$form, $form_state) {
global $user;
if ($gids = og_register_get_groups()) {
$account = clone $user;
field_attach_form('user', $account, $form, $form_state);
}
}