If I implement the hook_profile_alter:

 * Perform alterations profile items before they are rendered. You may omit/add/re-sort/re-categorize, etc.
 * @param $fields
 *   An array of $field objects, with unique module specified keys. Use this $key to find the item you care about.
 * @param $account
 *   A user object specifying whose profile is being rendered
 * @return
 *   None.
function hook_profile_alter(&$fields, $account) {
  foreach ($fields AS $key => $field) {
    // do something

I always get an error that the second argument is missing. (warning: Missing argument 2 for npuser_profile_alter())

If I use function hook_profile_alter(&$fields) (without the $account) no error occurs. Maybe the hook is not correctly called with both arguments?


Jared Scott’s picture

The API has changed going to drupal 6.x


function hook_profile_alter(&$account) {
  foreach ($account->content AS $key => $field) {
    // do something