[/php]
function merge_objects( $users, $data, $key ) {
foreach ( $users as $k => $user ) {
foreach ( $data as $d ) {
if ( is_array( $d ) ) {
if ( $d[‘ID’] != $user->ID ) {
continue;
}
$users[ $k ]->$key = $d[ $key ];
} else {
if ( $d->ID != $user->ID ) {
continue;
}
$users[ $k ]->$key = $d->$key;
}
}
}
return $users;
}