User options are now fetched with each user object
authorAlexander Ebert <ebert@woltlab.com>
Fri, 11 Nov 2011 15:19:35 +0000 (16:19 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 11 Nov 2011 15:19:35 +0000 (16:19 +0100)
XSD/userOption.xsd
com.woltlab.wcf/userOption.xml
wcfsetup/install/files/lib/data/user/User.class.php

index e29381140b9a6fdc96f0d1ec78db48919e827224..f2d7c8e765c696d21c75400cf3d8c96872a3a029 100644 (file)
@@ -78,7 +78,7 @@
                                                <xs:simpleType>
                                                        <xs:restriction base="xs:integer">
                                                                <xs:minInclusive value="0" />
-                                                               <xs:maxInclusive value="4" />
+                                                               <xs:maxInclusive value="7" />
                                                        </xs:restriction>
                                                </xs:simpleType>
                                        </xs:element>
@@ -91,4 +91,4 @@
                        </xs:extension>
                </xs:complexContent>
        </xs:complexType>
-</xs:schema>
\ No newline at end of file
+</xs:schema>
index e2be324da7aa2bd47ea1e38bdd91e0b73af69850..d9dd004243b2cf911b22624c382d8a0c98eb0889 100644 (file)
@@ -9,10 +9,10 @@
                        <option name="inlineHelpStatus">
                                <categoryname>hidden</categoryname>
                                <optiontype>text</optiontype>
-                               <visible>4</visible>
+                               <visible>0</visible>
                                <editable>4</editable>
                                <defaultvalue>all</defaultvalue>
                        </option>
                </options>
        </import>
-</data>
\ No newline at end of file
+</data>
index b20e373cc2eb81dc9c4e4f77dfe8b74f9eb15d50..69eecd4920e3237e697660819548ef94a659c38e 100644 (file)
@@ -18,7 +18,7 @@ use wcf\util\StringUtil;
  * @subpackage data.user
  * @category   Community Framework
  */
-class User extends DatabaseObject {
+final class User extends DatabaseObject {
        /**
         * @see wcf\data\DatabaseObject::$databaseTableName
         */
@@ -56,6 +56,30 @@ class User extends DatabaseObject {
         */
        protected static $userOptions = null;
        
+       /**
+        * @see wcf\data\DatabaseObject::__construct()
+        */
+       public function __construct($id, $row = null, User $object = null) {
+               if ($id !== null) {
+                       $sql = "SELECT          *
+                               FROM            wcf".WCF_N."_user user_table
+                               LEFT JOIN       wcf".WCF_N."_user_option_value user_option_value
+                               ON              (user_option_value.userID = user_table.userID)
+                               WHERE           user_table.userID = ?";
+                       $statement = WCF::getDB()->prepareStatement($sql);
+                       $statement->execute(array($id));
+                       $row = $statement->fetchArray();
+                       
+                       // enforce data type 'array'
+                       if ($row === false) $row = array();
+               }
+               else if ($object !== null) {
+                       $row = $object->data;
+               }
+               
+               $this->handleData($row);
+       }
+       
        /**
         * Returns true, if the given password is the correct password for this user.
         *