Add Hide email edit...
eevul - April 4, 2008 - 19:26
| Project: | No request new password |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | pedrofaria |
| Status: | closed |
Jump to:
Description
I am using Drupal 5.7 with this module and it works great to hide the password change. The only problem I am still having is that the email information for the user is pulled from our Active Directory using the LDAP module. When the user clicks on "My Account" and then clicks "Edit", he is still able to change his email address and we do not want that changed for obvious reasons. Is there anyway to configure this module to include the ability to disable users from changing their email addresses? Maybe I am barking up the wrong tree. Is there an easier way?

#1
Sorry about delay...
So... your request is not the initial propose of this module... but you can do it easily editing hook_form_alter of this module...
Cya
#2
#3
Thanks for the reply. I looked at the noreqnewpass.module but since I am fairly new to Drupal and not PHP savvy, I am not able to figure out what I need to do. Could you perhaps shed some light on how to disable the editing of emails for users? Basically it should have the same function as disabling the change password/request password.
Thanks in advance!
#4
I have disabled this module for now since it was causing some problems with my LDAP integration. I have enabled LDAP Data and when a new user would log in, their LDAP data (such as email, display name, etc.) would not be displayed and I would get this error (as long as account didn't exist):
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/site/modules/user/user.module on line 378.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /var/www/site/modules/user/user.module on line 379.
* warning: implode() [function.implode]: Invalid arguments passed in /var/www/site/modules/user/user.module on line 379.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/site/includes/database.mysql.inc on line 172.
I unchecked the "Disable Request new password link" and "Disable user change password ability", deleted the user account and had the user log in again and it was fine; no error and LDAP data was displayed. I tested this several times with several accounts with the same results.
#5
Change your module function to it...
cya
<?php
//...
function noreqnewpass_form_alter($form_id, &$form) {
if ($form_id == 'user_login_block' && variable_get('noreqnewpass_disabled', true)) {
$items = array();
if (variable_get('user_register', 1)) {
$items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.')));
}
$form['links'] = array('#value' => theme('item_list', $items));
}
if (($form_id == 'user_login_block' || $form_id == 'user_login') && variable_get('noreqnewpass_disabled', true)) {
$form['#validate'] = array('noreqnewpass_user_login_validate' => array());
}
if ($form_id == 'user_edit' && variable_get('noreqnewpass_disable_changepass', false)) {
unset($form['account']['pass']);
unset($form['account']['mail']);
}
}
//...
?>
#6
continue on:
http://drupal.org/node/243942
#7
Sorry for the delayed response as I got sidetracked with another project. I will try out your last suggestion and will let you know.
#8