You are here

public function UserMerger::merge in User Merge 2.x

Merges two user accounts.

Parameters

\Drupal\user\UserInterface $retire_user: The user being retired after the merge is complete.

\Drupal\user\UserInterface $retain_user: The user being retained after the merge is complete.

string $action_id: The id of the action plugin to be applied to the account being retired.

Return value

\Drupal\user\UserInterface The final merged account.

Overrides UserMergerInterface::merge

File

src/UserMerger.php, line 43

Class

UserMerger
A service for merging two Drupal user accounts.

Namespace

Drupal\usermerge

Code

public function merge(UserInterface $retire_user, UserInterface $retain_user, $action_id = 'action_block') {
  $this
    ->applyAction($action_id, $retire_user, $retain_user);
  foreach ($this
    ->getPropertyPlugins() as $plugin_id) {
    $this
      ->applyProperty($plugin_id, $retire_user, $retain_user);
  }
  return $retain_user;
}