diff --git a/includes/dbtypes/profile.class.php b/includes/dbtypes/profile.class.php index cf75fcb1..fe109400 100644 --- a/includes/dbtypes/profile.class.php +++ b/includes/dbtypes/profile.class.php @@ -662,7 +662,7 @@ class LocalProfileList extends ProfileList protected string $queryBase = 'SELECT p.*, p.`id` AS ARRAY_KEY FROM ?_profiler_profiles p'; protected array $queryOpts = array( 'p' => [['g'], 'g' => 'p.`id`'], - 'ap' => ['j' => ['?_account_profiles ap ON ap.`profileId` = p.`id`', true], 's' => ', (IFNULL(ap.`ExtraFlags`, 0) | p.`cuFlags`) AS "cuFlags"'], + 'ap' => ['j' => ['?_account_profiles ap ON ap.`profileId` = p.`id`', true], 's' => ', (IFNULL(ap.`extraFlags`, 0) | p.`cuFlags`) AS "cuFlags"'], 'atm' => ['j' => ['?_profiler_arena_team_member atm ON atm.`profileId` = p.`id`', true], 's' => ', atm.`captain`, atm.`personalRating` AS "rating", atm.`seasonGames`, atm.`seasonWins`'], 'at' => [['atm'], 'j' => ['?_profiler_arena_team at ON at.`id` = atm.`arenaTeamId`', true], 's' => ', at.`type`'], 'g' => ['j' => ['?_profiler_guild g ON g.`id` = p.`guild`', true], 's' => ', g.`name` AS "guildname"'] diff --git a/includes/user.class.php b/includes/user.class.php index e8028229..a854b225 100644 --- a/includes/user.class.php +++ b/includes/user.class.php @@ -780,7 +780,10 @@ class User if (self::$profiles === null) { - $conditions = [['OR', ['user', self::$id], ['ap.accountId', self::$id]]]; + $ap = DB::Aowow()->selectCol('SELECT `profileId` FROM ?_account_profiles WHERE `accountId` = ?d', self::$id); + + // the old approach ['OR', ['user', self::$id], ['ap.accountId', self::$id]] caused keys to not get used + $conditions = $ap ? [['OR', ['user', self::$id], ['id', array_keys($ap)]]] : ['user', self::$id]; if (!self::isInGroup(U_GROUP_ADMIN | U_GROUP_BUREAU)) $conditions[] = [['cuFlags', PROFILER_CU_DELETED, '&'], 0];