fetching user-options in getUserBy*() methods
authorJoshua Rüsweg <josh@joshsboard.de>
Sun, 27 Jul 2014 17:23:14 +0000 (19:23 +0200)
committerJoshua Rüsweg <josh@joshsboard.de>
Sun, 27 Jul 2014 17:23:14 +0000 (19:23 +0200)
wcfsetup/install/files/lib/data/user/User.class.php

index 6a0fe802a296d045aca4b864c98aabd947876b5e..658b098a7bb768e75bac9b48bfe96c6ac5d70585 100644 (file)
@@ -288,9 +288,11 @@ final class User extends DatabaseObject implements IRouteController, IUserConten
         * @return      \wcf\data\user\User
         */
        public static function getUserByUsername($username) {
-               $sql = "SELECT  *
-                       FROM    wcf".WCF_N."_user
-                       WHERE   username = ?";
+               $sql = "SELECT          user_option_value.*, user_table.*
+                       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.username = ?";
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(array($username));
                $row = $statement->fetchArray();
@@ -306,9 +308,11 @@ final class User extends DatabaseObject implements IRouteController, IUserConten
         * @return      \wcf\data\user\User
         */
        public static function getUserByEmail($email) {
-               $sql = "SELECT  *
-                       FROM    wcf".WCF_N."_user
-                       WHERE   email = ?";
+               $sql = "SELECT          user_option_value.*, user_table.*
+                       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.email = ?";
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(array($email));
                $row = $statement->fetchArray();