Hi, I'm using an `onUserBeforeUpdate()` hook to fire some user detail at an external API. I want to update the 3rd-party ONLY if items have changed. At the moment the items I'm checking are Firstname, Lastname and Email. Is there a flag or setting in the $event or $user that states whether the details have been updated? Right now I'm doing something like this: Code: $user = $event->getUser(); $old = $event->getOldUser(); $oldparams = [ 'oldUserEmail' => $old->email, 'oldUserFirst' => $old->name_f, 'oldUserLast' => $old->name_l ]; $newparams = [ 'newUserEmail' => $user->email, 'newUserFirst' => $user->name_f, 'newUserLast' => $user->name_l ]; $changes = array_diff((array) $old, (array) $user); If there was some sort of 'contains update' flag, I could avoid unnecessary checks on these arrays. Thanks! Ben
I believe the best approach is just compare these fields ie.: PHP: if ( $old->email != $user->email || $old->name_f != $user->name_f || $old->name_l != $user->name_l) { //do your actions}