return [
'template' => WCF::getTPL()->fetch('removeUserContentDialog', 'wcf', [
'knownContentProvider' => $knownContentProvider,
- 'userID' => $this->parameters['userID'],
- 'user' => $this->parameters['user']
+ 'userIDs' => $this->parameters['userIDs'],
+ 'users' => $this->parameters['users'],
+ 'userID' => $this->parameters['userID'] ?? null,
+ 'user' => $this->parameters['user'] ?? null,
])
];
}
* @since 5.2
*/
public function validatePrepareRemoveContent() {
- if (!isset($this->parameters['userID'])) {
- throw new \InvalidArgumentException("userID missing");
+ if (!isset($this->parameters['userIDs']) && isset($this->parameters['userID'])) {
+ $this->parameters['userIDs'] = [$this->parameters['userID']];
}
- $this->parameters['user'] = new User($this->parameters['userID']);
+ if (!isset($this->parameters['userIDs']) || !is_array($this->parameters['userIDs'])) {
+ throw new \InvalidArgumentException("Parameter 'userIDs' is missing or invalid.");
+ }
- if ($this->parameters['user']->userID && !$this->parameters['user']->canEdit()) {
- throw new PermissionDeniedException();
+ $userList = new UserList();
+ $userList->setObjectIDs($this->parameters['userIDs']);
+ $userList->readObjects();
+ $userObjects = $userList->getObjects();
+
+ $this->parameters['users'] = [];
+ foreach ($this->parameters['userIDs'] as $userID) {
+ if (!isset($userObjects[$userID])) {
+ throw new \InvalidArgumentException("The userID '". $userID ."' is unknown.");
+ }
+
+ if (!$userObjects[$userID]->canEdit()) {
+ throw new PermissionDeniedException();
+ }
+
+ $this->parameters['users'][] = $userObjects[$userID];
+ }
+
+ if (count($this->parameters['userIDs']) === 1) {
+ $this->parameters['userID'] = reset($this->parameters['userIDs']);
+ $this->parameters['user'] = reset($this->parameters['users']);
}
}
<category name="wcf.acp.content">
<item name="wcf.acp.content.removeContent"><![CDATA[Inhalte des Benutzers löschen]]></item>
<item name="wcf.acp.content.provider.removeContentSectionTitle"><![CDATA[Inhalte]]></item>
- <item name="wcf.acp.content.provider.removeContentInfo"><![CDATA[Bitte {if LANGUAGE_USE_INFORMAL_VARIANT}wähle{else}wählen Sie{/if} aus, welche Inhalte vom Benutzer „<a href="{link controller='UserEdit' id=$user->userID}{/link}">{$user->username}</a>“ gelöscht werden sollen.]]></item>
+ <item name="wcf.acp.content.provider.removeContentInfo"><![CDATA[Bitte {if LANGUAGE_USE_INFORMAL_VARIANT}wähle{else}wählen Sie{/if} aus, welche Inhalte {if $users|count == 1}vom Benutzer „<a href="{link controller='UserEdit' id=$user->userID}{/link}">{$user->username}</a>“{else}von {#$users|count} Benutzern{/if} gelöscht werden sollen.]]></item>
<item name="wcf.acp.content.provider.removeContentWarning"><![CDATA[<strong>Achtung</strong>: Der ausgewählte Inhalt wird nach dem Absenden <strong>unwiderruflich und ohne zusätzliche Sicherheitsabfrage</strong> gelöscht!]]></item>
<item name="wcf.acp.content.provider.com.woltlab.wcf.comment"><![CDATA[Kommentare]]></item>
<item name="wcf.acp.content.provider.com.woltlab.wcf.commentResponse"><![CDATA[Antworten auf Kommentare]]></item>
<category name="wcf.acp.content">
<item name="wcf.acp.content.removeContent"><![CDATA[Delete User’s Content]]></item>
<item name="wcf.acp.content.provider.removeContentSectionTitle"><![CDATA[Content]]></item>
- <item name="wcf.acp.content.provider.removeContentInfo"><![CDATA[Select which types of content created by “<a href="{link controller='UserEdit' id=$user->userID}{/link}">{$user->username}</a>” should be deleted.]]></item>
+ <item name="wcf.acp.content.provider.removeContentInfo"><![CDATA[Select which types of content created by {if $users|count == 1}“<a href="{link controller='UserEdit' id=$user->userID}{/link}">{$user->username}</a>”{else}{#$users|count} users{/if} should be deleted.]]></item>
<item name="wcf.acp.content.provider.removeContentWarning"><![CDATA[<strong>Heads up</strong>: The content will be deleted irrevocably and without any further confirmation prompt!]]></item>
<item name="wcf.acp.content.provider.com.woltlab.wcf.comment"><![CDATA[Comments]]></item>
<item name="wcf.acp.content.provider.com.woltlab.wcf.commentResponse"><![CDATA[Comment Responses]]></item>