You are here

function avatar_selection_images_form in Avatar Selection 5

Define a form to upload the avatar images.

2 string references to 'avatar_selection_images_form'
avatar_selection_menu in ./avatar_selection.module
Implementation of hook_menu().
avatar_selection_settings_page in ./avatar_selection.module

File

./avatar_selection.module, line 357

Code

function avatar_selection_images_form() {
  if (!variable_get('user_pictures', 0)) {
    drupal_set_message(t('User Pictures option is disabled.  You will need to enable this option before you can use the Avatar Selection module.  You may configure this setting on the <a href="@url">User settings</a> page.', array(
      '@url' => url('admin/user/settings'),
    )));
  }
  $form['#attributes']['enctype'] = 'multipart/form-data';
  $form['picture_upload'] = array(
    '#type' => 'file',
    '#title' => t('Upload image'),
    '#size' => 48,
    '#description' => t('A new avatar image.  Maximum dimensions are %dimensions and the maximum size is %size kB.  Images must have one of the following extensions (case sensitive): png, jpg, jpeg, gif, PNG, JPG, JPEG, GIF.', array(
      '%dimensions' => variable_get('user_picture_dimensions', '85x85'),
      '%size' => variable_get('user_picture_file_size', '30'),
    )) . ' ' . variable_get('user_picture_guidelines', ''),
  );
  $form['permissions'] = array(
    '#type' => 'fieldset',
    '#title' => t('Permissions'),
    '#weight' => 1,
  );
  $form['permissions']['access'] = array(
    '#type' => 'checkboxes',
    '#title' => t('User Roles'),
    '#options' => avatar_selection_handler_filter_role(),
    '#description' => t('Only the checked roles will be able to see this avatar icon; if no roles are checked, access will not be restricted.'),
  );
  if (module_exists("og")) {
    $form['permissions']['og_access'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Organic Groups'),
      '#options' => og_all_groups_options(),
      '#description' => t('Only users in the checked organic groups will be able to see this avatar icon; if no groups are checked, access will not be restricted.'),
    );
  }
  $form['attach'] = array(
    '#type' => 'submit',
    '#value' => t('Upload'),
    '#weight' => 10,
  );
  return $form;
}