How would I go about changing elements of the user account edit page?

i.e. I would like to move the upload avatar bit to the top, and add an image to it.

Comments

baldwinlouie’s picture

You can implement hook_form_alter() function. Once you implement this, you will have access to the form before it is rendered. Then you can play with the form element's weight attribute. Something like this. You can also add form elements to it inside this function

function foo_form_alter(&$form, $form_state, $form_id) {
  
  switch ($form_id) {
    case 'user_edit':

      $form['ELEMENT_NAME']['#weight'] = '1'; //to move it to the once spot
     );
     break;
    default:
      break;
  }
}

Baldwin Louie,
BitSprout LLC
http://www.bitsprout.net

unxposed’s picture

Thanks for that. Could I just put this in the template.php file or would I need to create a module. (which I don't think I'm able to do - not very good at php!)?

Thanks!

baldwinlouie’s picture

This method would require a module. This should get your started: http://drupal.org/node/231276

Baldwin Louie,
BitSprout LLC
http://www.bitsprout.net

unxposed’s picture

Thanks. I created a module called moveforms:

<?php

function moveforms_form_alter(&$form, $form_state, $form_id) {

  switch ($form_id) {

    case 'user_profile_form':

      // Change the Username field title to Profile name.
      $form['account']['name']['#title'] = t('Profile name');
	  $form['picture']['#weight'] = '-50';
	  unset($form['guestbook']);
	  unset($form['block']);
	  unset($form['og_settings']);
      break;
  }
}
?>