MyBB Community Forums

Full Version: Private messages FluxBB -> myBB1.8
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
It seems that Merge System forget to import PrivateMessages ... (database = SQLITE3)

I try to do the job with a script but I don't understand all the meaning of 'recipients' column of table 'privatemessages' :

I guess that :

a:number_1

(s:number_2, "type_of_recipient",a:number_3 (i:number_4;s:number_5:"number_6")


number_1 = number of recipients,
number_3 = id of the writer,
number_5 = index of each individuel recipient ( from 1 to number_1 )
number_6 = id of each recipient,

but number_2 (always 2 ??) and number_4 (always 0 ??) please ...
There's no private message module (yet).

The recipients column is an array which is serialized. PM's need some special love, so here's an example (uid 1 sent pm to uid 2):
toid: 2
fromid: 1
recipients: a:1:{s:2:"to";a:1:{i:0;s:1:"2";}}
-> array("to" => array(2))

As we save one copy per recipient you need to set uid and folder per entry:
uid = 2 => folder = 1 (Inbox)
uid = 1 => folder = 2 (Outbox)

There're also a few more things you need to do when sending a message to multiple recipients:
The toid column contains the same id as the uid field for recipients and "0" for the sender.
Two normal recipients: a:1:{s:2:"to";a:2:{i:0;s:1:"2";i:1;s:1:"3";}}
-> array("to" => array(2,3))
One bcc and one normal: a:2:{s:2:"to";a:1:{i:0;s:1:"2";}s:3:"bcc";a:1:{i:0;s:1:"3";}}
-> array("to" => array(2), "bcc" => array(3))

Edit: I can't find the option for privatemessages on my stock fluxbb installation?
******
uid = 2 => folder = 1 (Inbox)
uid = 1 => folder = 2 (Outbox)
*******

I've understood Wink
JSON serialize I supposed ?

But, in your last line (for 'boc' ans 'to'), it's always "s:2 (number_2) and "i:0 (number_4) and what are they mean ?


Oooooops : haven't you receive my SQLITE3 database ?? There is an message-table ... Wink
I've your database however I've also my own test database Wink

There's a php function called serialize which is used (I've linked to it above). You need to build the array I've posted below the serialized line, and then pass that array to serialize.
Sorry Sad '(I've linked to it above)' ?? I've not see any link ...

Try to send 2 messages from id 12 to id 5 ans id 7 (for distinct 'order message' and id recippient) : it'll be more clear in the JSON serialized string.

***** in the same object ... It will be great to maintain the Ids of users during Merge System :

- in order my job is easier to buid myBB table of privatemessage,
- because FluxBB offert 'quick links' to forum, posts, topics and member (using their id, of course Big Grin ) . I've some troubles with Id_forum because I have not delete "My Forum" (the first wich is created automaticaly before MERGE SYSTEM and, of course with the BBcode [user=id]text[/user] because Ids members are not the same in FluxBB and myBB Wink
http://php.net/manual/de/function.serialize.php

You can also take a look at the other private message modules or at the "inc/datahandlers/pm.php" file.
OK !! I've all understood Wink

nb1 = 1 if only ('to') or only ('bcc') / 2 if ('to') AND ('bcc')
nb2 = length ( type message) : 2 if 'to', 3 if 'bcc'
nb3 = nb (recipients for the type of message),
nb4 = index of the recipients
nb5 = length of id_recipient (witch is a string)
nb6 = string (id_recipient) !!

Yessssssss ! I could translate Message table !
It's been a long time since this message, but I'm actually doing the exact same thing (converting private messages from flux to mybb). ArouG, do you happen to have that old script available or, anyone else, something to work with? Thank you all!

These are the two tables. I'm really struggling to write something that resembles a good script...

TABLE mybb_privatemessages (
pmid int(10) UNSIGNED NOT NULL,
uid int(10) UNSIGNED NOT NULL DEFAULT 0,
toid int(10) UNSIGNED NOT NULL DEFAULT 0,
fromid int(10) UNSIGNED NOT NULL DEFAULT 0,
recipients text NOT NULL,
folder smallint(5) UNSIGNED NOT NULL DEFAULT 1,
subject varchar(120) NOT NULL DEFAULT '',
icon smallint(5) UNSIGNED NOT NULL DEFAULT 0,
message text NOT NULL,
dateline int(10) UNSIGNED NOT NULL DEFAULT 0,
deletetime int(10) UNSIGNED NOT NULL DEFAULT 0,
status tinyint(1) NOT NULL DEFAULT 0,
statustime int(10) UNSIGNED NOT NULL DEFAULT 0,
includesig tinyint(1) NOT NULL DEFAULT 0,
smilieoff tinyint(1) NOT NULL DEFAULT 0,
receipt tinyint(1) NOT NULL DEFAULT 0,
readtime int(10) UNSIGNED NOT NULL DEFAULT 0,
ipaddress varbinary(16) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;

TABLE fluxbb_messages (
id int(10) UNSIGNED NOT NULL,
shared_id int(10) NOT NULL DEFAULT 0,
last_shared_id int(10) NOT NULL DEFAULT 0,
last_post int(10) DEFAULT 0,
last_post_id int(10) DEFAULT 0,
last_poster varchar(255) NOT NULL DEFAULT '0',
owner varchar(255) NOT NULL DEFAULT '0',
subject varchar(255) NOT NULL DEFAULT '',
message mediumtext NOT NULL,
hide_smilies tinyint(1) NOT NULL DEFAULT 0,
show_message tinyint(1) NOT NULL DEFAULT 0,
sender varchar(200) NOT NULL DEFAULT '',
receiver varchar(200) DEFAULT NULL,
sender_id int(10) NOT NULL DEFAULT 0,
receiver_id varchar(255) DEFAULT '0',
sender_ip varchar(39) DEFAULT NULL,
posted int(10) NOT NULL DEFAULT 0,
showed tinyint(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Is there anyone a bit keener than me who can give any suggestion? Even a general one. I am definitely struggling to find a way out and a bit lost. :-)

Thank you all. :-)
(2023-11-16, 05:18 AM)oscon Wrote: [ -> ]It's been a long time since this message, but I'm actually doing the exact same thing (converting private messages from flux to mybb). ArouG, do you happen to have that old script available or, anyone else, something to work with? Thank you all!

These are the two tables. I'm really struggling to write something that resembles a good script...

TABLE mybb_privatemessages (
pmid int(10) UNSIGNED NOT NULL,
uid int(10) UNSIGNED NOT NULL DEFAULT 0,
toid int(10) UNSIGNED NOT NULL DEFAULT 0,
fromid int(10) UNSIGNED NOT NULL DEFAULT 0,
recipients text NOT NULL,
folder smallint(5) UNSIGNED NOT NULL DEFAULT 1,
subject varchar(120) NOT NULL DEFAULT '',
icon smallint(5) UNSIGNED NOT NULL DEFAULT 0,
message text NOT NULL,
dateline int(10) UNSIGNED NOT NULL DEFAULT 0,
deletetime int(10) UNSIGNED NOT NULL DEFAULT 0,
status tinyint(1) NOT NULL DEFAULT 0,
statustime int(10) UNSIGNED NOT NULL DEFAULT 0,
includesig tinyint(1) NOT NULL DEFAULT 0,
smilieoff tinyint(1) NOT NULL DEFAULT 0,
receipt tinyint(1) NOT NULL DEFAULT 0,
readtime int(10) UNSIGNED NOT NULL DEFAULT 0,
ipaddress varbinary(16) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;

TABLE fluxbb_messages (
id int(10) UNSIGNED NOT NULL,
shared_id int(10) NOT NULL DEFAULT 0,
last_shared_id int(10) NOT NULL DEFAULT 0,
last_post int(10) DEFAULT 0,
last_post_id int(10) DEFAULT 0,
last_poster varchar(255) NOT NULL DEFAULT '0',
owner varchar(255) NOT NULL DEFAULT '0',
subject varchar(255) NOT NULL DEFAULT '',
message mediumtext NOT NULL,
hide_smilies tinyint(1) NOT NULL DEFAULT 0,
show_message tinyint(1) NOT NULL DEFAULT 0,
sender varchar(200) NOT NULL DEFAULT '',
receiver varchar(200) DEFAULT NULL,
sender_id int(10) NOT NULL DEFAULT 0,
receiver_id varchar(255) DEFAULT '0',
sender_ip varchar(39) DEFAULT NULL,
posted int(10) NOT NULL DEFAULT 0,
showed tinyint(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Hello ! My old code : https://github.com/ArouG/PHP-Mess-FluxBB--MyBB
Pages: 1 2