function og_ui_add_users_submit in Organic groups 7
Same name and namespace in other branches
- 7.2 og_ui/og_ui.admin.inc \og_ui_add_users_submit()
Submit handler; Add users to group.
File
- og_ui/
og_ui.admin.inc, line 156 - Admin settings for Organic groups module.
Code
function og_ui_add_users_submit($form, &$form_state) {
$account = user_load_by_name($form_state['values']['og_add_user']);
$form_state['values'] += array(
'membership_fields' => array(),
);
$values = array(
// Entity type is user by default.
'entity' => $account,
'state' => $form_state['values']['og_add_user_state'],
'membership type' => $form_state['values']['og_add_user_membership_type'],
'membership fields' => $form_state['values']['membership_fields'],
);
og_group($form_state['values']['group']->gid, $values);
drupal_set_message(t('%user has been added to group.', array(
'%user' => $account->name,
)));
}