PDA

View Full Version : Issue with MyBB to vBulletin Import


Alice
02 Jan 2016, 18:36
Okay so, I went to import MyBB to vBulletin. The importing was successful, however there we're two issues.

1. The account birthdays we're imported as invalid dates.
2. The IP's we're imported incorrectly because of the way they are stored in the MyBB database, which is different from vBulletin.

The first was fixed by running a sql query that resets everyone's birthdays

For the IP issue, I want to run a sql query that will reset everyone's IP to nothing, which will auto-correct as people login.

If you can help me with a sql query that will take care of the second issue, I would appreciate it.

Thank you,

Lynne
02 Jan 2016, 21:50
Are you talking about the IPs that show in the posts? Or the IP that shows in the admincp when you look up a user?

(And if you set either of those to nothing, they will not auto-correct unless you write some code to do that)?

Alice
02 Jan 2016, 22:13
I thought that when you look up a person's ip, that the ip you find, is the one that is recorded as of the person's last login/post?

Alice
03 Jan 2016, 22:58
Anyone able to offer any support?

Dave
03 Jan 2016, 23:02
vBulletin does not store the last login IP. The IP you see in the admincp is the IP address of the user when they made the account.

Alice
04 Jan 2016, 02:14
Are you sure about that? Then what about the ip address that gets recorded when someone makes a post?

ozzy47
04 Jan 2016, 02:28
That's stored in the post table.

Alice
04 Jan 2016, 02:41
Hmm. Then, I'm not sure how to fix this problem then...

Dave
04 Jan 2016, 15:49
You could create a hook at login_verify_success with the following query:
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET ipaddress = '" . IPADDRESS . "' WHERE userid = " $vbulletin->userinfo['userid']);

This will update the IP address column in the user table every time the user logged in.

Lynne
04 Jan 2016, 20:23
Are you sure about that? Then what about the ip address that gets recorded when someone makes a post?
Positive. The ipaddress in the user table, the same one that shows in the admincp, is the one the user used to register the account. The IPs in the post table are the IP used to make that specific post.

Alice
04 Jan 2016, 20:38
You could create a hook at login_verify_success with the following query:
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET ipaddress = '" . IPADDRESS . "' WHERE userid = " $vbulletin->userinfo['userid']);

This will update the IP address column in the user table every time the user logged in.

Any idea how to implement this? Is this just a query I need to run or a template edit?

Thank you,

MarkFL
04 Jan 2016, 20:44
Any idea how to implement this? Is this just a query I need to run or a template edit?

Thank you,

You need to create a plugin. Follow:

AdminCP -> Plugins & Products -> Add New Plugin

Product: vBulletin

Hook Location: login_verify_success

Title: Add IP Address To user Table

Execution Order: 5

Plugin PHP Code:

$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET ipaddress = '" . IPADDRESS . "' WHERE userid = " $vbulletin->userinfo['userid']);

Plugin is Active: Yes

Then click "Save".

Dave
04 Jan 2016, 20:45
https://www.vbulletin.com/docs/html/main/add_plugin?manualversion=30506500

Product name: vBulletin
Hook: login_verify_success
PHP code: the one I just posted
Active: yes

Edit: Mark faster than me.

Alice
04 Jan 2016, 20:58
Thank you, everyone in this thread has been very helpful and I appreciate it.

Thank you,