- register_watch_op($this->user->id(), WATCH_FICHE, '', 'search_names');
- set_profile_display($this->display_names);
- set_alias_names($this->sn_new, $this->sn_old, true, $this->new_alias);
+ set_profile_display($this->display_names, $this->profile);
+
+ if (!is_null($this->profileOwner)) {
+ set_alias_names($this->sn_new, $this->sn_old, $this->profile->id(),
+ $this->profileOwner->id(), true, $this->new_alias);
+
+ // Update the local User object, to pick up the new bestalias.
+ $this->profileOwner = User::getSilentWithUID($this->profileOwner->id());
+ }
+