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

Fixed vB>xenforo Comments all have album owner's name

Discussion in 'Media Gallery Resolved Bugs' started by vbuser, Jan 15, 2015.

  1. vbuser

    vbuser Active Member

    Just wanted to check if this was intended. Xenforo imported the comments but they all appear as the username of the album owner.
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Which vBulletin version did you import from?

    And was it the default vBulletin albums or some other add-on like PhotoPost Pro or vBGallery?
     
  3. vbuser

    vbuser Active Member

    4.2.2 and no gallery addons
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    I can see how that might happen.

    Are you in a position to test this again? Or the comments step, at least?

    File: library/XenGallery/Importer/vBulletin42x.php
    Line: 541

    Change from:
    PHP:
    SELECT comment.*, user.*, filedata.*, attachment.*
    To:
    PHP:
    SELECT comment.*, user.*, filedata.*, attachment.*, comment.username AS username
    If you can make that change before trying again, I think that should solve the problem.
     
  5. Thanks, @Chris D . We will be running another test this week. Will make that change and report back.
     
    Chris D likes this.
  6. imthebest

    imthebest Formerly Super120

    Is the vBulletin 3 importer also affected by this bug?
     
  7. Chris D

    Chris D XenForo Developer Staff Member

    If you've ever used the vB3 importer you can probably tell me for sure. It would affect all images and comments if so. The fix would be slightly different, though.

    Certainly the database schema is different so it's possible it isn't.
     
  8. imthebest

    imthebest Formerly Super120

    I can confirm that this problem doesn't affect the vBulletin 3 importer.
     
    Chris D likes this.
  9. @Chris D got this error:

    Mysqli prepare error: Unknown column 'comment.username' in 'field list'
     
  10. Chris D

    Chris D XenForo Developer Staff Member

    My mistake, I didn't have a vB4 database in front of me at the time.

    It's likely going to be:

    Change from:
    PHP:
    SELECT comment.*, user.*, filedata.*, attachment.*
    To:
    PHP:
    SELECT comment.*, user.*, filedata.*, attachment.*, user.username AS username
     
  11. @Chris D ,

    I deleted all the photos and albums from the last import, updated the file and then reimported.

    Unfortunately, same result: the comments still show as comign from the OP.

    http://makerfare.com/index.php?media/halo-3-recon-and-reachcon-mashup.544/




     
  12. Chris D

    Chris D XenForo Developer Staff Member

    Hi,

    Really sorry that didn't work out.

    I believed there was an overlap of the "username" field in a couple of tables. I believed that the comments table had a field named "username" and the picture table also had a field named "username". However, this isn't the case.

    The comment table has its own username field which I somehow managed to miss. It also has its own user ID field.

    The fix I'm making then, for the next version is this:

    Change:
    PHP:
    'user_id' => $this->_userIdMap[$comment['userid']],
    'username' => $this->_convertToUtf8($comment['username'], true),
    To:
    PHP:
    'user_id' => $this->_userIdMap[$comment['postuserid']],
    'username' => $this->_convertToUtf8($comment['postusername'], true),
    That can be found on lines 597 and 598 in vBulletin42x.php.

    You can undo the change outlined here, it isn't needed:
     
  13. @Chris D , that did work although there are a few issues. It does now show the comments, attributed to the correct member. However, the member name isn't linked to their profile nor is their avatar showing up. From what I can see, it looks like it is literally pulling the name over and nothing else. Is that correct?
     
  14. Chris D

    Chris D XenForo Developer Staff Member

    I have sent you a Conversation message that has an updated Importer attached. It includes an additional change which should bring across the correct user IDs.
     
  15. Chris D

    Chris D XenForo Developer Staff Member

    Excellent.

    Thanks for testing that.
     

Share This Page