You are here

function group_membership_actions_form_submit in Group 7

Submit handler for group_membership_actions_form().

File

forms/group.membership_actions.inc, line 38
Group membership actions form generator.

Code

function group_membership_actions_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  $group = $form_state['build_info']['args'][0];
  $account = $form_state['build_info']['args'][1];

  // Retrieve the membership (if it exists).
  $group_membership = $group
    ->getMember($account->uid);

  // Call the clicked action's callback.
  foreach (group_membership_action_info() as $action => $info) {
    if (isset($values["op_{$action}"])) {
      call_user_func($info['action callback'], $group, $account, $group_membership);
    }
  }
}