function hook_profile2_load in Profile 2 7.2
Same name and namespace in other branches
- 7 profile2.api.php \hook_profile2_load()
Act on profiles being loaded from the database.
This hook is invoked during profile loading, which is handled by entity_load(), via the EntityCRUDController.
Parameters
$entities: An array of profile2 entities being loaded, keyed by id.
See also
File
- ./
profile2.api.php, line 26 - This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.
Code
function hook_profile2_load($entities) {
$result = db_query('SELECT pid, foo FROM {mytable} WHERE pid IN(:ids)', array(
':ids' => array_keys($entities),
));
foreach ($result as $record) {
$entities[$record->pid]->foo = $record->foo;
}
}