From: Sergey Fayngold Date: Fri, 11 Mar 2016 22:40:47 +0000 (+0100) Subject: Add getUserByAuthData method to the User data object X-Git-Tag: 3.0.0_Beta_1~2038 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d32e9ca2f2ecd23caa1268e4da1f37d12ead5d2f;p=GitHub%2FWoltLab%2FWCF.git Add getUserByAuthData method to the User data object --- diff --git a/wcfsetup/install/files/lib/data/user/User.class.php b/wcfsetup/install/files/lib/data/user/User.class.php index 59fca7298e..ec9a26ae11 100644 --- a/wcfsetup/install/files/lib/data/user/User.class.php +++ b/wcfsetup/install/files/lib/data/user/User.class.php @@ -314,6 +314,26 @@ final class User extends DatabaseObject implements IRouteController, IUserConten return new User(null, $row); } + + /** + * Returns the user with the given authData. + * + * @param string $authData + * @return \wcf\data\user\User + */ + public static function getUserByAuthData($authData) { + $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.authData = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($authData)); + $row = $statement->fetchArray(); + if (!$row) $row = array(); + + return new User(null, $row); + } /** * Returns true if this user is marked.