This is the code from my mod:
Code:
$dm =& datamanager_init('PM', $vbulletin);
$dm->set('fromuserid', 1);
$dm->set('fromusername', 'Jaxel');
$dm->set('title', "this is a test title");
$dm->set('message', "this is a test message");
$dm->set('dateline', TIMENOW);
$dm->set_recipients('testaccount', $botpermissions);
$dm->overridequota = true;
$dm->save();
As you can see, there are no mistakes in this code... however it prompts the following error:
Code:
Database error in vBulletin 4.0.3:
Invalid SQL:
INSERT INTO pmtext
(fromuserid, fromusername, title, message, dateline, touserarray, pmtextid) VALUES
(1, 'Jaxel', 'this is a test title', 'this is a test message', 1273475035, 'a:1:{s:3:\"bcc\";a:1:{i:2;s:11:\"testaccount\";}}', 5);
MySQL Error : Duplicate entry '5' for key 1
Error Number : 1062
Request Date : Monday, May 10th 2010 @ 03:03:55 AM
Error Date : Monday, May 10th 2010 @ 03:03:56 AM
Script : ...../media_ajax.php?do=comment
Referrer : ...../media/m621-algol-killer-combos
IP Address : ....
Username : testaccount
Classname : vB_Database
MySQL Version :
Stack Trace:
#0 vB_Database->halt() called in [path]/includes/class_core.php on line 421
#1 vB_Database->execute_query() called in [path]/includes/class_core.php on line 439
#2 vB_Database->query_write() called in [path]/includes/class_dm.php on line 740
#3 vB_DataManager->db_insert() called in [path]/includes/class_dm.php on line 890
#4 vB_DataManager->save() called in [path]/media/media_comment.php on line 80
#5 require_once([path]/media/media_comment.php) called in [path]/media_ajax.php on line 87
It looks like the system attempts to input the PMTEXT into the database twice... anyone know how to fix?