function privatemsg_migrate_prepare_privatemsg in Migrate Extras 6
Implementation of hook_migrate_prepare().
File
- ./
privatemsg.migrate.inc, line 41 - Integrates privatemsg module with the migrate module
Code
function privatemsg_migrate_prepare_privatemsg(&$msg, $tblinfo, $row) {
//we can't just pass the $msg object into privatemsg_new_thread() as is, so lets fix it up.
//get full user objects for author and recipients, seems like a lot of overhead?
$author = user_load(array(
'uid' => $msg->author,
));
$recipient = user_load(array(
'uid' => $msg->recipient,
));
$new_thread->recipients = array(
$recipient,
);
//set options
$options['author'] = $author;
$options['timestamp'] = $msg->timestamp;
$options['format'] = $msg->format;
$new_thread->options = $options;
$new_thread->message = $msg->body;
$new_thread->subject = $msg->subject;
//add new items to msg (while keeping the old for later)
$msg->new_thread = $new_thread;
}