By blackburnandrew on
I made this module from another forum topic. The purpose is to disable the changing of a user name and password. It does a great job at that. The only problem I have is when I want to create a new user as an administrator I have to disable this module. It is blocking any of the form fields included in the userchange module code, these fields are obviously crucial for making a user.
Does anyone know any drupal speficic code that can make this module be null for an administrator on the site? If not, does anyone know how to automatically disable this code when an administrator logs in?
<?php
function userchange_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('This prevents office users from changing their user name and password.');
}
}
function userchange_user($op, &$edit, &$user, $category = NULL) {
switch ($op) {
case 'validate':
//lets validate the user info
if ($_POST['edit']['name'] != $user->name) {
form_set_error('name', t('You cannot change your user name right now. Only an administrator can perform that task.'));
}
if ($_POST['edit']['pass1'] != $user->pass1) {
form_set_error('pass1', t('You cannot change your password right now. Only an administrator can perform that task.'));
}
if ($_POST['edit']['pass2'] != $user->pass2) {
}
break;
}
}
?>
Comments
This is how I managed permissions:
My issue is fixed. I eventually figured out how to do it myself.