Re: BP Messages – Database details?
Thanks, Andy! I went into the database and observed how these arrays morph as more posts are made. Here’s what I figured out about the serialized array in BP’s wp_bp_messages_threads table:
First of all, the wp_bp_messages_threads table is indeed the table that associates “messages” table with “recipients” table.
In the message_ids column:
a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:5;}
– a:4 means there are 4 messages in the thread
– the i’s are the links between messages in the thread. There are 4 messages in the thread, and the thread IDs are 1, 2, 3, and 5. I’m not sure why we start with i:0 to i:1, but after that the connections are i:1 to i:2, i:2 to i:3, and i:3 to i:5.
In the sender_ids column:
a:2:{i:0;i:1;i:1;s:1:”2″;}
– I guess a:2 means that the sender has 2 messages in the thread, but I don’t know why that information is useful yet. I don’t know what the i’s mean in this context. I don’t know what s means. “2” is the user_id of the sender.
I was able to put this together and come up with a simple import script that turns phpBB message data into BP messages. It’s just a “flat” import, by which I mean that the script does not use the BP threading functionality; it just gives every message a simple “message_ids” table entry, such as a:1:{i:0;i:55;} where 55 is the id of the message, and a simple “sender_ids” entry, such as a:1:{i:0;i:3;}, where 3 is the id of the user in wp_users.
Is somebody putting all this in the codex? I don’t feel I’m qualified enough to enter these snippets, but hopefully this type of documentation will be emerging soon.