Fix for Code

  1. function mymod_install() {
  2.   db_query("UPDATE {system} SET weight = -1 WHERE name = 'mymod'");
  3. }
  4.  
  5. function mymod_form_alter(&$form, &$form_state, $form_id) {
  6.   if ($form_id == 'user_profile_form') {
  7.     $roles = user_roles(TRUE);
  8.     $form['account']['roles']['#type'] = 'select';
  9.     $form['account']['roles']['#options'] = $roles;
  10.   }
  11. }
  12.  
  13. function mymod_user($type, &$edit, &$account, $category = NULL) {
  14.   if ($type == 'submit' && !is_array($edit['roles'])) {
  15.     if ($edit['roles'] !== NULL) {
  16.       $edit['roles'] = array('2' => TRUE, $edit['roles'] => $edit['roles']);
  17.     }
  18.     else {
  19.       $edit['roles'] = array('2' => TRUE);
  20.     }
  21.   }
  22. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.