From 104530a925429191dfe7db921d0a9fb4539f766e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 12 Jan 2014 21:29:15 +0100 Subject: [PATCH] Fix SMF exporter when no custom profile fields exist --- .../system/exporter/SMF2xExporter.class.php | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/files/lib/system/exporter/SMF2xExporter.class.php b/files/lib/system/exporter/SMF2xExporter.class.php index 6485b24..e18e769 100644 --- a/files/lib/system/exporter/SMF2xExporter.class.php +++ b/files/lib/system/exporter/SMF2xExporter.class.php @@ -271,20 +271,22 @@ class SMF2xExporter extends AbstractExporter { // wtf?! if (empty($userIDs)) return; - + // get profile field values - $condition = new PreparedStatementConditionBuilder(); - $condition->add('id_member IN(?)', array($userIDs)); - $condition->add('variable IN(?)', array(array_keys($profileFields))); $profileFieldValues = array(); - $sql = "SELECT * - FROM ".$this->databasePrefix."themes - ".$condition; - $statement = $this->database->prepareStatement($sql); - $statement->execute($condition->getParameters()); - while ($row = $statement->fetchArray()) { - if (!isset($profileFieldValues[$row['id_member']])) $profileFieldValues[$row['id_member']] = array(); - $profileFieldValues[$row['id_member']][$profileFields[$row['variable']]['id_field']] = $row['value']; + if (!empty($profileFields)) { + $condition = new PreparedStatementConditionBuilder(); + $condition->add('id_member IN(?)', array($userIDs)); + $condition->add('variable IN(?)', array(array_keys($profileFields))); + $sql = "SELECT * + FROM ".$this->databasePrefix."themes + ".$condition; + $statement = $this->database->prepareStatement($sql); + $statement->execute($condition->getParameters()); + while ($row = $statement->fetchArray()) { + if (!isset($profileFieldValues[$row['id_member']])) $profileFieldValues[$row['id_member']] = array(); + $profileFieldValues[$row['id_member']][$profileFields[$row['variable']]['id_field']] = $row['value']; + } } // get users -- 2.20.1