You are here

function user_stats_form_alter in User Stats 5

Implementation of hook_form_alter().

File

./user_stats.module, line 505
User Stats provides commonly requested user statistics for themers. These are:

Code

function user_stats_form_alter($form_id, &$form) {
  if ($form_id == 'user_edit') {
    if ($form['_category']['#value'] == 'Statistics') {
      if (isset($form['Statistics'])) {
        foreach ($form['Statistics'] as $field => $value) {
          if (is_array($value) && $value['#type'] == 'textfield') {
            $form['Statistics'][$field]['#disabled'] = TRUE;
            $form['Statistics'][$field]['#description'] = 'Field not editable.';
          }
        }
      }
      else {
        $form['no_settings_error'] = array(
          '#value' => t('Sorry, there is nothing for you to see here.'),
        );
      }
      unset($form['submit']);
      unset($form['delete']);
    }
  }
}