Skip to main content
added 12 characters in body
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

This is the most straightforward method, in a custom module:.

  $role = user_role_load_by_name('role-name');
  user_save($account, array('roles' => $account->roles + array($role->rid => $role->name)));
}
function MY_MODULE_user_insert($account, $data) {
  $role = user_role_load_by_name('role-name');
  user_save($account, array('roles' => $account->roles + array($role->rid => $role->name)));
}

This is the most straightforward method, in a custom module:

  $role = user_role_load_by_name('role-name');
  user_save($account, array('roles' => $account->roles + array($role->rid => $role->name)));
}

This is the most straightforward method, in a custom module.

function MY_MODULE_user_insert($account, $data) {
  $role = user_role_load_by_name('role-name');
  user_save($account, array('roles' => $account->roles + array($role->rid => $role->name)));
}
Source Link
W.M.
  • 732
  • 6
  • 15

This is the most straightforward method, in a custom module:

  $role = user_role_load_by_name('role-name');
  user_save($account, array('roles' => $account->roles + array($role->rid => $role->name)));
}