Log in

View Full Version : how do i send a private message (pm) using datamanager


GrowersPro
01-19-2006, 04:23 AM
how do i send a private message (pm) using datamanager ?

I need to integrate vbulletin into a cms.

I need to find the documentation about being able using datamanager to
insert into the vbulletin pm tables a private message from a user coming from the cms

I already know how to replicate users from my CMS into vbulletin.

thus I need to get the doc about the datamanager "Private Messages"

what parameters do we pass ?

what are the name of the variables?

I could not find anything in the official doc

thank you for your help
Reply With Quote

Princeton
01-19-2006, 12:42 PM
this is just a copy/paste ... you will need to take a look at private.php to get a better idea of what you need
// create the DM to do error checking and insert the new PM
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);

$pmdm->set_info('savecopy', $pm['savecopy']);
$pmdm->set_info('receipt', $pm['receipt']);
$pmdm->set_info('cantrackpm', $cantrackpm);
$pmdm->set_info('parentpmid', $pm['pmid']);
$pmdm->set_info('forward', $pm['forward']);

$pmdm->set('fromuserid', $vbulletin->userinfo['userid']);
$pmdm->set('fromusername', $vbulletin->userinfo['username']);
$pmdm->setr('title', $pm['title']);
$pmdm->setr('message', $pm['message']);
$pmdm->set_recipients($pm['recipients'], $permissions);
$pmdm->setr('iconid', $pm['iconid']);
$pmdm->set('dateline', TIMENOW);
$pmdm->setr('showsignature', $pm['signature']);
$pmdm->set('allowsmilie', $pm['disablesmilies'] ? 0 : 1);

($hook = vBulletinHook::fetch_hook('private_insertpm_proces s')) ? eval($hook) : false;

$pmdm->pre_save();
// preview stuff goes here
// everything's good!
$pmdm->save();

You may also have to update user's pm counts

GrowersPro
01-19-2006, 06:08 PM
concerning this line

$pmdm->set_recipients($pm['recipients'], $permissions);

do you know what needs to be included in $permissions ?

i tried the usergroupid

but when i look at the tabl

pmtext the array is

a:1:{i:11;s:12:"Chanel";}

i am not sure what i and s in the array stands for

I thought the i in the array was the usergroupid from the table vbusergroup

i am not sure waht really goes into the

$permissions

and the error given by class vb_datamanager_pm is not very helpful

----------------------
ERROR0:The following users were not found:

1. 11

Fatal error: Unable to proceed with save while $errors array is not empty in class vb_datamanager_pm in /includes/class_dm.php on line 758

----------------------------

i know that the user id 11 exists because i did several pm tests from the vbulletin application and i look after in the table to see what is saved.

any help would be appreciated

Andreas
01-19-2006, 06:13 PM
Check the tutorial forum.

GrowersPro
01-19-2006, 06:15 PM
nevermind i found the solution

i thought that $recipients needed to contain the userid field and in fact it needs to be the username field.

I can not get used to that. why can't they rely on a record id to link two tables?