function PartyUserDataSetUIAttach::action_form_submit in Party 7
Same name and namespace in other branches
- 8.2 modules/party_user/includes/party_user.data_ui.inc \PartyUserDataSetUIAttach::action_form_submit()
Form submission for the action form.
Overrides PartyDefaultDataSetUIAttach::action_form_submit
File
- modules/
party_user/ includes/ party_user.data_ui.inc, line 53 - Provides classes for UI actions on the user data set.
Class
- PartyUserDataSetUIAttach
- The 'attach' action: attach an existing entity.
Code
function action_form_submit($form, &$form_state) {
// Get the original form parameters.
list($party, $data_set, $action, $eid) = $form_state['build_info']['args'];
// Attempt to load a user from the given input.
$account = user_load_by_name($form_state['values']['user']);
if ($account->uid != 0) {
// Attach the user entity to the party.
$party
->getDataSetController($data_set['set_name'])
->attachEntity($account)
->save();
}
}