You are here

function avatar_selection_edit_form_submit in Avatar Selection 5.2

Same name and namespace in other branches
  1. 5 avatar_selection.module \avatar_selection_edit_form_submit()

Submit the image list form in the Avatar Selection - 'Manage Avatars' page.

Function called when the Update button is pressed.

Parameters

$form_id: The form id.

$form_values: Array containing the form values submitted.

File

./avatar_selection.module, line 1065
The Avatar Selection module allows the user to pick an avatar image from a list already loaded by an administrative user, and to the administrator to disable uploading other avatar files by the user.

Code

function avatar_selection_edit_form_submit($form_id, $form_values) {
  $op = $form_values['op'];
  if ($op == t('Update')) {
    $access = array_keys(array_filter($form_values['access']));
    if (module_exists("og")) {
      $og = array_keys(array_filter($form_values['og_access']));
    }
    $name = $form_values['avatar_name'];
    $weight = $form_values['avatar_weight'];
    _avatar_selection_save_avatar_info($form_values['aid'], $form_values['select_avatar'], $name, $access, $og, $weight);
    drupal_set_message(t('Image updated.'));
  }
  elseif ($op == t('Delete')) {
    $image = $form_values['select_avatar'];
    $deleted = avatar_selection_image_delete($image);
    if ($deleted) {
      drupal_set_message(t('Image deleted.'));
    }
  }
}