Fix SMF exporter when no custom profile fields exist
authorTim Düsterhus <timwolla@googlemail.com>
Sun, 12 Jan 2014 20:29:15 +0000 (21:29 +0100)
committerTim Düsterhus <timwolla@googlemail.com>
Sun, 12 Jan 2014 20:29:15 +0000 (21:29 +0100)
files/lib/system/exporter/SMF2xExporter.class.php

index 6485b245a8b6eab2ed4693c4b227ecac9d6fb3ee..e18e7694abb36a31910219da16a643f34d31ffd0 100644 (file)
@@ -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