You are here

function gprofile_group_membership_submit in Group 7

Submit handler for editing profiles onto a membership.

1 string reference to 'gprofile_group_membership_submit'
gprofile_form_group_membership_form_alter in modules/gprofile/gprofile.module
Implements hook_form_FORM_ID_alter().

File

modules/gprofile/gprofile.module, line 90
Main module code for the Group member profiles project.

Code

function gprofile_group_membership_submit(&$form, &$form_state) {
  $group_membership = $form_state['group_membership'];
  foreach ($form_state['gprofiles'] as $field_name => $gprofile) {
    field_attach_submit('gprofile', $gprofile, $form[$field_name], $form_state);

    // We should have a membership id by now.
    if ($gprofile->mid == -1) {
      $gprofile->mid = $group_membership->mid;
    }
    $gprofile
      ->save();
  }
}