function flexiaccess_user_validate in Flexi Access 7
File
- ./
flexiaccess.users.inc, line 220 - Form handling for per user ACL.
Code
function flexiaccess_user_validate($form, &$form_state) {
$types = array_filter(variable_get('flexiaccess_types', array()));
if (!is_numeric($form_state['values']['add'])) {
form_set_error('add', t('Enter a node ID, or type the title and select a node from the autocomplete list.'));
return;
}
$node = node_load($form_state['values']['add']);
if (!$node) {
form_set_error('add', t('Could not find a node with ID @nid', array(
'@nid' => $form_state['values']['add'],
)));
return;
}
if (!in_array($node->type, $types)) {
form_set_error('add', t('Flexiaccess is not configured to manage nodes of type <code>!type</code>.', array(
'!type' => $node->type,
)));
return;
}
// If all is OK, add the new nid to the list of uncommitted nodes.
$form_state['uncommitted'][] = $node->nid;
}