You are here

function og_ui_confirm_subscribe_submit in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og_ui/og_ui.pages.inc \og_ui_confirm_subscribe_submit()

Submit handler; Confirm OG membership.

File

og_ui/og_ui.pages.inc, line 130
Page callbacks for Group module.

Code

function og_ui_confirm_subscribe_submit($form, &$form_state) {
  $group = $form_state['values']['group'];
  $account = $form_state['values']['account'];
  $state = og_user_access($group->gid, 'subscribe without approval') ? OG_STATE_ACTIVE : OG_STATE_PENDING;
  $values = array(
    'entity' => $account,
    'state' => $state,
    'membership type' => $form_state['values']['membership_type'],
    'membership fields' => $form_state['values']['membership_fields'],
  );
  og_group($group->gid, $values);

  // Redirect.
  $form_state['redirect'] = "{$group->entity_type}/{$group->etid}";
}