Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

drupal hide account email and password change for non admin user

is there a way to block from user to change his password/email / username after he signed up?

like image 835
amirash Avatar asked Oct 11 '22 11:10

amirash


1 Answers

A standard Drupal install can prevent changing username, without adding any extra modules. Preventing change of password is probably a rather rarely-requested feature; I've never heard of a module that does that.

The way I would do this would be to write a small module that uses hook_form_alter to modify the form, and remove these fields. You would also need to figure out how links to the lost password feature are formed, and edit them out of the appropriate template. This you should find easily enough by searching through the code; if the template files are located in the /modules directory, be sure to copy them into your theme directory and refresh your theme cache.

Here's a tutorial for using hook_form_alter: http://www.lullabot.com/articles/modifying-forms-drupal-5-and-6

Note Bedir's comment here about use of #access to prevent form elements from being included in the form.

like image 108
James Avatar answered Oct 21 '22 03:10

James