The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Explanation of the touserarray in table PMTEXT
Hi!
I am currently working on several scripts that later on will migrate my current forum to vBulletin 3.7. So far I'm doing alright. Most of the information such as users, threads and posts are importing correctly into vBulletin which is good news. Now I'm trying to work out a script that will migrate all the PM's from my custom forum database. The tables that the PM function is made up of is pm, pmtext, pmreceipt, in the vBulletin database. It's easy to understand what the information is doing in in most of tables. There is on field though, called touserarray, in table pmtext, that I need som help to parse, exactly what elements it's made up of! touserarray: Code:
a:1:{s:2:"cc";a:1:{i:10;s:5:"LeonL";}} Regards, Fredrik |
#2
|
|||
|
|||
You can use explode() on that string and it will return an array with all the values.
PS Why not use the DataManagers, would make things a lot easier and you do not need to know which tables store which information. PPS To write an importer, you could use ImpEx as an example and write a new module based on existing ones. |
#3
|
|||
|
|||
Thanks for you reply!
I assume the DataManager can be used when the forum from which you are importing is well known and supported by vBulletin, right? In my case I'm importing from my very own custom forum and I feel ImpEx won't do the job for me. I gave it a try but I soon realized that it was not going to handle all my information the way I wanted. This leaves me with the option to hard code scripts myself for the various categories I want to migrate. So far everything is working out very good. One of the last thing is to get the PM's in place. You say I can use explode() on that string. It would be very helpful if you could give me a code example. |
#4
|
|||
|
|||
DataManagers are used to manipulate the data in the vBulletin database. They have no connection with the system you are using to get the data. They are basically an API that will provide an interface to edit/insert/delete data without having to access the tables directly. You can find more information in our Articles section.
Sorry made a typo in my previous post, you should be using unserialize() on the string to get an array. Example: PHP Code:
Code:
Var string: a:1:{s:2:"cc";a:1:{i:10;s:5:"LeonL";}} Array array: Array( [cc] => Array ( [10] => LeonL )) |
#5
|
|||
|
|||
When you say DataManagers I assume you refer to functions and classes within the various php-files that vBulletin is made up of? First you have to be some what of a detective and look those up in a specific file I guess?
Thanks for your example. The only information of value really that comes out of the array when you run unserialize is the userID and username. Do you now what those other numbers are for in that string? I sent three test PM from my admin account to the three users to see how/if the touserarray values other than userID/username changes. This is the result taken from the database: Code:
a:1:{s:2:"cc";a:1:{i:185;s:4:"Adam";}} a:1:{s:2:"cc";a:1:{i:245;s:10:"cjsundberg";}} a:1:{s:2:"cc";a:1:{i:309;s:6:"19-555";}} I need to know this when I import so that I can anticipate the correct value. |
#6
|
|||
|
|||
Hum, sorry to interveine, but it's a serialized entry... unserialize() is needed!
|
#7
|
|||
|
|||
2nd paragraph of post #4 my dear.
|
#8
|
|||
|
|||
Quote:
But if you want to know: a:1:{s:2:"cc";a:1:{i:185;s:4:"Adam";}} a:1:{..} - Array with 1 entry s:2:"cc"; - String, 2 positions, value "cc" a:1:{....} - Array with 1 entry i:185; - Integer, value 185 (probably userid on this example) s:4:"Adam"; - String, 4 positions, value "Adam" |
#9
|
|||
|
|||
So it wasn't more complicated than that after all?! The way you describe it, it seems like a straight forward process to populate the array and the store the whole PM-post into the database.
Thanks for your explanation. This means I will have a good night sleep not having to think about this array! |
#10
|
|||
|
|||
How would I populate this array?
Like this before I serialize it?! PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|