You are here

function avatar_selection_config_form in Avatar Selection 5

Same name and namespace in other branches
  1. 5.2 avatar_selection.module \avatar_selection_config_form()
  2. 6 avatar_selection.admin.inc \avatar_selection_config_form()
  3. 7 avatar_selection.admin.inc \avatar_selection_config_form()

Define a form to configure the module settings

2 string references to 'avatar_selection_config_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 310

Code

function avatar_selection_config_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'),
    )));
  }

  // To store how many avatars per page are displayed.
  $form['update']['avatar_per_page'] = array(
    '#type' => 'textfield',
    '#title' => t('How many avatars per page'),
    '#description' => t('The number of avatars to show per page.'),
    '#default_value' => variable_get('avatar_selection_avatar_per_page', 30),
    '#size' => 3,
  );
  $form['update']['disable_user_upload'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disable users uploading pictures to profile'),
    '#description' => t('Allow users to pick their avatar from the selection but prevent them from uploading new avatars when editing their account.'),
    '#default_value' => variable_get('avatar_selection_disable_user_upload', FALSE),
  );
  $form['update']['force_set_image_reg'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force users to select an avatar image on user registration.'),
    '#description' => t('This only comes into effect on the user registration screen.'),
    '#default_value' => variable_get('avatar_selection_force_user_avatar_reg', FALSE),
  );
  $form['update']['force_set_image'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force users to select an avatar image when editing their account'),
    '#description' => t('This only comes into effect when the user is editing their account details and image uploads are disabled.'),
    '#default_value' => variable_get('avatar_selection_force_user_avatar', FALSE),
  );
  $form['update']['set_random_default'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable random default avatar image.'),
    '#description' => t('Automatically set a random avatar image to be used when the user doesn\'t set one for their account.'),
    '#default_value' => variable_get('avatar_selection_set_random_default', FALSE),
  );
  $form['update']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update'),
  );
  return $form;
}