You are here

function xmlsitemap_user_form_alter in XML sitemap 5

Same name and namespace in other branches
  1. 5.2 xmlsitemap_user/xmlsitemap_user.module \xmlsitemap_user_form_alter()

Implementation of hook_form_alter().

Related topics

File

xmlsitemap_user/xmlsitemap_user.module, line 98
Adds user profiles to the site map.

Code

function xmlsitemap_user_form_alter($form_id, &$form) {
  switch ($form_id) {
    case 'user_admin_settings':
      $form['xmlsitemap'] = array(
        '#type' => 'fieldset',
        '#title' => t('Site map'),
      );
      $default = variable_get('xmlsitemap_user_default_priority', 0.5);
      $form['xmlsitemap']['xmlsitemap_user_old_default_priority'] = array(
        '#type' => 'value',
        '#value' => $default,
      );
      $form['xmlsitemap']['xmlsitemap_user_default_priority'] = array(
        '#type' => 'select',
        '#title' => t('Default user priority'),
        '#default_value' => $default,
        '#options' => xmlsitemap_priority_options('exclude'),
        '#description' => t('Choose the default priority for users who have only the authenticated user role.'),
      );
      $form['buttons']['#weight'] = 1;
      $form['#submit']['_xmlsitemap_user_submit'] = array();
      break;
    case 'user_admin_role':
      $form['xmlsitemap_user_role_priority'] = array(
        '#type' => 'select',
        '#title' => t('Default site map priority'),
        '#default_value' => db_result(db_query("SELECT priority FROM {xmlsitemap_user_role} WHERE rid = %d", $form['rid']['#value'])),
        '#options' => xmlsitemap_priority_options('exclude'),
        '#description' => t('This number will be added to the priority of this user role.'),
      );
      $form['submit']['#weight'] = 1;
      $form['delete']['#weight'] = 1;
      $form['#submit']['_xmlsitemap_user_submit'] = array();
      break;
  }
}