From: Marcel Werk Date: Thu, 24 Oct 2024 12:21:20 +0000 (+0200) Subject: Take articles into account when merging users X-Git-Tag: 6.1.0~6^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=090ae94d6291742cb7be6f284c30a837ad42d22a;p=GitHub%2FWoltLab%2FWCF.git 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/ --- 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();