$DB_site->query("INSERT INTO " . TABLE_PREFIX . "pm (pmtextid, userid) VALUES $pmquery");
$DB_site->shutdown_query("UPDATE " . TABLE_PREFIX . "user SET pmtotal=pmtotal+1, pmunread=pmunread+1 WHERE userid IN ($in)");
}
$title and $text should be the title and body of the message respectively, $user can either be an array of a username and userid, or an array of arrays of usernames and userids if you are sending to multiple people ($user['userid'] and $user['username'] or $user[0]['userid'] and so on). $from should be a username/userid array of the user you want the PM to be from, or if it is not set, it defaults to $bbuserinfo. It also has a $from = "default" code in there which could be used, but you might want to change the setting it looks for.