1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 Importing Polls

Discussion in 'Installation, Upgrade, and Import Support' started by Valhalla, Feb 17, 2014.

  1. Valhalla

    Valhalla Well-Known Member

    I get the error below when trying to import polls stage using the MyBB importer.

    It may or may not be related to this: http://xenforo.com/community/threads/duplicate-entry-error.29424

  2. Jeremy

    Jeremy Well-Known Member

    Is the poll attached to multiple threads?
  3. Valhalla

    Valhalla Well-Known Member

    Just checked, and yes it was... For some reason the database I am importing from has two polls attached to one thread.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Does MyBB allow that? If so then the importer should be changed to account for that. If not then it's a problem with your MyBB data which needs to be manually fixed in the database before running the import again.
  5. Valhalla

    Valhalla Well-Known Member

    Should have said, no MyBB doesn't allow that as standard. It is definitely something unique to my database.

    I deleted the duplicate entry, and the import completed successfully after that.
  6. Valhalla

    Valhalla Well-Known Member

    I'm looking for some advice, and I should say this is unique to me and not the MyBB importer.

    Poll options are delimited by a set of unique characters, but because of the way the poll entries are included in my database, the final option has a delimiter after it. An example is this: "Yes||~|~||No||~|~||Maybe||~|~||". This creates a problem when using the importer because it creates an empty poll option.

    Basically, I need to modify the importer to remove empty values when exploding a string. How can I alter the following line (or otherwise) to do this?

    $responses explode('||~|~||'$this->_convertToUtf8($poll['options'], true));
  7. Jeremy

    Jeremy Well-Known Member

  8. Valhalla

    Valhalla Well-Known Member

    Thanks, worked.

Share This Page