Moderator/Super-Moderator overhaul
authorMarcel Werk <burntime@woltlab.com>
Sat, 24 May 2014 11:11:50 +0000 (13:11 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sat, 24 May 2014 11:11:50 +0000 (13:11 +0200)
com.woltlab.wcf/userGroupOption.xml
wcfsetup/install/files/acp/post_install.php
wcfsetup/install/files/lib/data/user/group/UserGroup.class.php
wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml
wcfsetup/setup/db/install.sql

index 6c107425e2cc0e7bce4c4d849375a4557a0620d3..38a1126a0dc5e90af42e443c0e25b22b48b47089 100644 (file)
@@ -553,7 +553,7 @@ png]]></defaultvalue>
                                <categoryname>mod.general</categoryname>
                                <optiontype>boolean</optiontype>
                                <defaultvalue>0</defaultvalue>
-                               <admindefaultvalue>1</admindefaultvalue>
+                               <moddefaultvalue>1</moddefaultvalue>
                        </option>
                        
                        <option name="user.like.canViewLike">
@@ -574,19 +574,19 @@ png]]></defaultvalue>
                                <categoryname>mod.profileComment</categoryname>
                                <optiontype>boolean</optiontype>
                                <defaultvalue>0</defaultvalue>
-                               <admindefaultvalue>1</admindefaultvalue>
+                               <moddefaultvalue>1</moddefaultvalue>
                        </option>
                        <option name="mod.profileComment.canDeleteComment">
                                <categoryname>mod.profileComment</categoryname>
                                <optiontype>boolean</optiontype>
                                <defaultvalue>0</defaultvalue>
-                               <admindefaultvalue>1</admindefaultvalue>
+                               <moddefaultvalue>1</moddefaultvalue>
                        </option>
                        <option name="mod.profileComment.canModerateComment">
                                <categoryname>mod.profileComment</categoryname>
                                <optiontype>boolean</optiontype>
                                <defaultvalue>0</defaultvalue>
-                               <admindefaultvalue>1</admindefaultvalue>
+                               <moddefaultvalue>1</moddefaultvalue>
                        </option>
                        <!-- /mod.general -->
                        
index 4b30119c5334e897b646be6f24f640b16303ca9b..442713fdd28d8f18c1f47dbae43948d40b8afff6 100644 (file)
@@ -24,19 +24,3 @@ $action = new UserProfileAction(array($editor), 'updateUserRank');
 $action->executeAction();
 $action = new UserProfileAction(array($editor), 'updateUserOnlineMarking');
 $action->executeAction();
-
-// set default mod permissions
-$sql = "INSERT IGNORE INTO     wcf".WCF_N."_user_group_option_value
-                               (groupID, optionID, optionValue)
-       SELECT                  5, optionID, 1
-       FROM                    wcf".WCF_N."_user_group_option
-       WHERE                   optionName LIKE 'mod.%'";
-$statement = WCF::getDB()->prepareStatement($sql);
-$statement->execute();
-$sql = "INSERT IGNORE INTO     wcf".WCF_N."_user_group_option_value
-                               (groupID, optionID, optionValue)
-       SELECT                  6, optionID, 1
-       FROM                    wcf".WCF_N."_user_group_option
-       WHERE                   optionName LIKE 'mod.%'";
-$statement = WCF::getDB()->prepareStatement($sql);
-$statement->execute();
index 65d4a73cfbed9e5d8d3823974ee28b8faf5de485..164686817595eba3a03558ac7fa61ca6a3e536c4 100644 (file)
@@ -214,6 +214,18 @@ class UserGroup extends DatabaseObject {
                return count(array_diff($groupIDs, $accessibleGroupIDs)) == 0 ? true : false;
        }
        
+       /**
+        * Returns true if the current group is a moderator-group.
+        * 
+        * @reutn       boolean
+        */
+       public function isModGroup() {
+               // workaround for WCF-Setup
+               if (!PACKAGE_ID && $this->groupID == 5) return true;
+               
+               return $this->getGroupOption('mod.general.canUseModeration');
+       }
+       
        /**
         * Loads the group cache.
         */
index 81139ec6b8838168a366340710f13aa66d5023b8..87385de3d94d5e786bc224d801aa917e6bf549e6 100644 (file)
@@ -38,7 +38,7 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst
         */
        protected function saveOption($option, $categoryName, $existingOptionID = 0) {
                // default values
-               $optionName = $optionType = $defaultValue = $adminDefaultValue = $userDefaultValue = $validationPattern = $enableOptions = $permissions = $options = '';
+               $optionName = $optionType = $defaultValue = $adminDefaultValue = $modDefaultValue = $userDefaultValue = $validationPattern = $enableOptions = $permissions = $options = '';
                $showOrder = null;
                
                // get values
@@ -46,6 +46,7 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst
                if (isset($option['optiontype'])) $optionType = $option['optiontype'];
                if (isset($option['defaultvalue'])) $defaultValue = $option['defaultvalue'];
                if (isset($option['admindefaultvalue'])) $adminDefaultValue = $option['admindefaultvalue'];
+               if (isset($option['moddefaultvalue'])) $modDefaultValue = $option['moddefaultvalue'];
                if (isset($option['userdefaultvalue'])) $userDefaultValue = $option['userdefaultvalue'];
                if (isset($option['validationpattern'])) $validationPattern = $option['validationpattern'];
                if (!empty($option['showorder'])) $showOrder = intval($option['showorder']);
@@ -97,16 +98,25 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst
                        $groupOptionEditor = UserGroupOptionEditor::create($data);
                        $optionID = $groupOptionEditor->optionID;
                        
-                       $groupIDs = $this->getGroupIDs();
+                       $this->getGroupIDs();
                        $values = array();
-                       foreach ($this->groupIDs['admin'] as $groupID) {
-                               $values[$groupID] = ((isset($option['admindefaultvalue']) && $defaultValue != $adminDefaultValue) ? $adminDefaultValue : $defaultValue);
+                       foreach ($this->groupIDs['all'] as $groupID) {
+                               $values[$groupID] = $defaultValue;
                        }
-                       foreach ($this->groupIDs['registered'] as $groupID) {
-                               $values[$groupID] = ((isset($option['userdefaultvalue']) && $defaultValue != $userDefaultValue) ? $userDefaultValue : $defaultValue);
+                       if (isset($option['userdefaultvalue'])) {
+                               foreach ($this->groupIDs['registered'] as $groupID) {
+                                       $values[$groupID] = $userDefaultValue;
+                               }
                        }
-                       foreach ($this->groupIDs['other'] as $groupID) {
-                               $values[$groupID] = $defaultValue;
+                       if (isset($option['moddefaultvalue'])) {
+                               foreach ($this->groupIDs['mod'] as $groupID) {
+                                       $values[$groupID] = $modDefaultValue;
+                               }
+                       }
+                       if (isset($option['admindefaultvalue'])) {
+                               foreach ($this->groupIDs['admin'] as $groupID) {
+                                       $values[$groupID] = $adminDefaultValue;
+                               }
                        }
                        
                        // save values
@@ -135,7 +145,8 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst
                if ($this->groupIDs === null) {
                        $this->groupIDs = array(
                                'admin' => array(),
-                               'other' => array(),
+                               'mod' => array(),
+                               'all' => array(),
                                'registered' => array()
                        );
                        
@@ -145,16 +156,17 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst
                        $statement->execute();
                        while ($row = $statement->fetchArray()) {
                                $group = new UserGroup(null, $row);
-                               if ($group->groupType == UserGroup::EVERYONE || $group->groupType == UserGroup::GUESTS) {
-                                       $this->groupIDs['other'][] = $group->groupID;
-                               }
-                               else {
+                               $this->groupIDs['all'][] = $group->groupID;
+                               
+                               if ($group->groupType != UserGroup::EVERYONE && $group->groupType != UserGroup::GUESTS) {
+                                       $this->groupIDs['registered'][] = $group->groupID;
+                                       
+                                       if ($group->isModGroup()) {
+                                               $this->groupIDs['mod'][] = $group->groupID;
+                                       }
                                        if ($group->isAdminGroup()) {
                                                $this->groupIDs['admin'][] = $group->groupID;
                                        }
-                                       else {
-                                               $this->groupIDs['registered'][] = $group->groupID;
-                                       }
                                }
                        }
                }
index 6672c72d4d3e0518caaeba3307ae379e3bba17ad..189562bdd667315e020d32b9cbefa7a5dbad7008 100644 (file)
                <item name="wcf.acp.group.group3"><![CDATA[Registrierte Benutzer]]></item>
                <item name="wcf.acp.group.group4"><![CDATA[Administratoren]]></item>
                <item name="wcf.acp.group.group5"><![CDATA[Moderatoren]]></item>
-               <item name="wcf.acp.group.group6"><![CDATA[Super-Moderatoren]]></item>
                <item name="wcf.acp.group.list"><![CDATA[Benutzergruppen]]></item>
                <item name="wcf.acp.group.members"><![CDATA[Mitglieder]]></item>
                <item name="wcf.acp.group.option.admin.display.canManagePageMenu"><![CDATA[Kann Seitenmenü verwalten]]></item>
@@ -2805,7 +2804,6 @@ Möchten Sie diese E-Mail-Benachrichtigung in Zukunft nicht mehr erhalten, könn
        <category name="wcf.user.rank">
                <item name="wcf.user.rank.administrator"><![CDATA[Administrator]]></item>
                <item name="wcf.user.rank.moderator"><![CDATA[Moderator]]></item>
-               <item name="wcf.user.rank.superModerator"><![CDATA[Super-Moderator]]></item>
                <item name="wcf.user.rank.user0"><![CDATA[Anfänger]]></item>
                <item name="wcf.user.rank.user1"><![CDATA[Schüler]]></item>
                <item name="wcf.user.rank.user2"><![CDATA[Fortgeschrittener]]></item>
index 2666ee3d3ccc092a353f00f69bb67472da6ae640..754e533aa7427aefd3b976435f368dfd5f138a37 100644 (file)
@@ -235,7 +235,6 @@ Examples for medium ID detection:
                <item name="wcf.acp.group.group3"><![CDATA[Users]]></item>
                <item name="wcf.acp.group.group4"><![CDATA[Administrators]]></item>
                <item name="wcf.acp.group.group5"><![CDATA[Moderators]]></item>
-               <item name="wcf.acp.group.group6"><![CDATA[Super Moderators]]></item>
                <item name="wcf.acp.group.list"><![CDATA[User Groups]]></item>
                <item name="wcf.acp.group.members"><![CDATA[Members]]></item>
                <item name="wcf.acp.group.option.admin.display.canManagePageMenu"><![CDATA[Can manage page menu]]></item>
@@ -2689,7 +2688,6 @@ If you do not want to receive further email notifications for this event, you ca
        <category name="wcf.user.rank">
                <item name="wcf.user.rank.administrator"><![CDATA[Administrator]]></item>
                <item name="wcf.user.rank.moderator"><![CDATA[Moderator]]></item>
-               <item name="wcf.user.rank.superModerator"><![CDATA[Super-Moderator]]></item>
                
                <item name="wcf.user.rank.user0"><![CDATA[Beginner]]></item>
                <item name="wcf.user.rank.user1"><![CDATA[Student]]></item>
index 0745050ef6802dfb4bbcb8ad0034e0f0711b9df7..62dcdaa39a8d041aafc360c1c17e2069b1b6d2d0 100644 (file)
@@ -1599,7 +1599,6 @@ INSERT INTO wcf1_user_group (groupID, groupName, groupType) VALUES (2, 'wcf.acp.
 INSERT INTO wcf1_user_group (groupID, groupName, groupType) VALUES (3, 'wcf.acp.group.group3', 3); -- Registered Users
 INSERT INTO wcf1_user_group (groupID, groupName, groupType) VALUES (4, 'wcf.acp.group.group4', 4); -- Administrators
 INSERT INTO wcf1_user_group (groupID, groupName, groupType) VALUES (5, 'wcf.acp.group.group5', 4); -- Moderators
-INSERT INTO wcf1_user_group (groupID, groupName, groupType) VALUES (6, 'wcf.acp.group.group6', 4); -- Super-Moderators
 
 -- default user group options
 INSERT INTO wcf1_user_group_option (optionID, optionName, categoryName, optionType, defaultValue, showOrder) VALUES (1, 'admin.general.canUseAcp', 'admin.general', 'boolean', '0', 1);
@@ -1741,17 +1740,15 @@ INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('messageSid
 -- default priorities
 UPDATE wcf1_user_group SET priority = 10 WHERE groupID = 3;
 UPDATE wcf1_user_group SET priority = 1000 WHERE groupID = 4;
-UPDATE wcf1_user_group SET priority = 50 WHERE groupID = 5;
-UPDATE wcf1_user_group SET priority = 100 WHERE groupID = 6;
+UPDATE wcf1_user_group SET priority = 100 WHERE groupID = 5;
 
 -- default 'showOnTeamPage' setting
-UPDATE wcf1_user_group SET showOnTeamPage = 1 WHERE groupID IN (4, 5, 6);
+UPDATE wcf1_user_group SET showOnTeamPage = 1 WHERE groupID IN (4, 5);
 
 -- default ranks
 INSERT INTO wcf1_user_rank (groupID, requiredPoints, rankTitle, cssClassName) VALUES
        (4, 0, 'wcf.user.rank.administrator', 'blue'),
        (5, 0, 'wcf.user.rank.moderator', 'blue'),
-       (6, 0, 'wcf.user.rank.superModerator', 'blue'),
        (3, 0, 'wcf.user.rank.user0', ''),
        (3, 300, 'wcf.user.rank.user1', ''),
        (3, 900, 'wcf.user.rank.user2', ''),