From 090ae94d6291742cb7be6f284c30a837ad42d22a Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Thu, 24 Oct 2024 14:21:20 +0200 Subject: [PATCH] Take articles into account when merging users ref https://www.woltlab.com/community/thread/308576-when-merging-two-users-the-cms-articles-are-not-assigned-to-the-new-target-user/ --- .../install/files/lib/acp/form/UserMergeForm.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wcfsetup/install/files/lib/acp/form/UserMergeForm.class.php b/wcfsetup/install/files/lib/acp/form/UserMergeForm.class.php index 2dcf3dc0ae..abc3589192 100644 --- a/wcfsetup/install/files/lib/acp/form/UserMergeForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserMergeForm.class.php @@ -272,6 +272,15 @@ class UserMergeForm extends AbstractForm $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters())); + // articles + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); + $sql = "UPDATE wcf" . WCF_N . "_article + SET userID = ? + " . $conditions; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(\array_merge([$this->destinationUserID], $conditions->getParameters())); + // delete merged users $action = new UserAction($this->mergedUserIDs, 'delete'); $action->executeAction(); -- 2.20.1