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

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.
 

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?
 

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.
 

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.
 

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
 

Movie Prop Sites

Active member
@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/




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
 

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:
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
 

Movie Prop Sites

Active member
@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?
 

Chris D

XenForo developer
Staff member
@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?
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.
 
Top