You are here

function term_permissions_validate in Taxonomy Term Permissions 7

Same name and namespace in other branches
  1. 6 term_permissions.module \term_permissions_validate()

Validation function to ensure that the selected user exists.

Parameters

$form: The current form array.

$form_state: The state of the current form.

1 string reference to 'term_permissions_validate'
term_permissions_form_alter in ./term_permissions.module
Implements hook_form_alter().

File

./term_permissions.module, line 208
Allows access to terms in a vocabulary to be limited by user or role.

Code

function term_permissions_validate($form, &$form_state) {
  if (!empty($form_state['values']['access']['user'])) {
    $allowed_users = drupal_explode_tags($form_state['values']['access']['user']);
    foreach ($allowed_users as $name) {
      if (!array_shift(user_load_multiple(array(), array(
        'name' => $name,
      )))) {
        form_set_error('search_user', t('The user %name does not exist.', array(
          '%user' => $name,
        )));
      }
    }
  }
}