Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By scoorch on
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?
Comments
API change to 6
The API has changed going to drupal 6.x
http://api.drupal.org/api/function/hook_profile_alter