Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Source Link

Custom edit user page

I'm trying to build an edit form for specific users. For one type of user I want to hide password field for example

What I did is to create a module called profilechange.

Into profilechange.module I wrote this code :

function profilechange_form_alter(&$form, $form_state, $form_id) {
    if ($form_id == 'user-profile-form') {
       hide($form['account']['pass']);
       hide($form['account']['current_pass_required_values']);
       hide($form['account']['current_pass']);
    }
}

So I enable the module and into my page--user--edit.tpl.php I've this code :

<?php print render($page['content']); ?>

It displays the default edit form. But password fields are not hidden.

That's why I need your help, I don't know why it does not work even if I clear the cache