user_admin_access_check

Versions
4.6 – 6
user_admin_access_check()

Menu callback: check an access rule

Code

modules/user.module, line 1358

<?php
function user_admin_access_check() {
  if ($_POST['op']) {
    $op = $_POST['op'];
  }
  $edit = $_POST['edit'];

  if ($op) {
    if (user_deny($edit['type'], $edit['test'])) {
      drupal_set_message(t('%test is not allowed.', array('%test' => theme('placeholder', $edit['test']))));
    }
    else {
      drupal_set_message(t('%test is allowed.', array('%test' => theme('placeholder', $edit['test']))));
    }
  }

  $form = form_textfield(t('Username'), 'test', '', 32, 64, t('Enter a username to check if it will be denied or allowed.'));
  $form .= form_hidden('type', 'user');
  $form .= form_submit(t('Check username'));
  $output .= form($form);

  $form = form_textfield(t('E-mail'), 'test', '', 32, 64, t('Enter an e-mail address to check if it will be denied or allowed.'));
  $form .= form_hidden('type', 'mail');
  $form .= form_submit(t('Check e-mail'));
  $output .= form($form);

  print theme('page', $output);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.