Add support for hidden user content provider
authorJoshua Rüsweg <josh@bastelstu.be>
Thu, 22 Nov 2018 09:45:28 +0000 (10:45 +0100)
committerJoshua Rüsweg <josh@bastelstu.be>
Sun, 25 Nov 2018 14:46:47 +0000 (15:46 +0100)
Hidden content providers are useful, if a user content provider requires to delete other content first, before the user content provider can remove their content.
See #2716

wcfsetup/install/files/lib/data/user/UserAction.class.php

index ece147d27d17a7388d43028be1f840f2e842ff83..3866ccc99feaea7084aa4044621abe43ff0b930a 100644 (file)
@@ -809,7 +809,9 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio
        public function prepareRemoveContent() {
                $knownContentProvider = array_map(function ($contentProvider) {
                        return $contentProvider->objectType;
-               }, ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.content.userContentProvider'));
+               }, array_filter(ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.content.userContentProvider'), function ($contentProvider) {
+                       return !$contentProvider->hidden;
+               }));
                
                return [
                        'template' => WCF::getTPL()->fetch('removeUserContentDialog', 'wcf', [