vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   how do i send a private message (pm) using datamanager (https://vborg.vbsupport.ru/showthread.php?t=105686)

GrowersPro 01-19-2006 04:23 AM

how do i send a private message (pm) using datamanager
 
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
PHP Code:

    // create the DM to do error checking and insert the new PM
    
$pmdm =& datamanager_init('PM'$vbulletinERRTYPE_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'] ? 1);

    (
$hook vBulletinHook::fetch_hook('private_insertpm_process')) ? 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?


All times are GMT. The time now is 10:24 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01105 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete