Contributions API

Calling all Drupal developers!

Help us get this on the first page of Digg. DIGG NOW!

Modules in 6

avatar_selection_config_form

Definition

avatar_selection_config_form()
contributions/avatar_selection/avatar_selection.module, line 531

Description

Create the form structure for configuring the avatar module settings; seen in the 'Configure' tab under the Avatar Selection administration page.

Return value

Return the structure of the form.

Code

<?php
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 applies 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 applies 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']['distinctive_avatars'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable distinctive avatars.'),
    '#description' => t('Only allow users to pick an avatar that isn\'t already in use by another user.  If there are no available avatars left, the default avatar image will be used.'),
    '#default_value' => variable_get('avatar_selection_distinctive_avatars', FALSE),
    );


  $form['update']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update'),
  );

  return $form;
}
?>