vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Autofill PM from form. (https://vborg.vbsupport.ru/showthread.php?t=187886)

noj75 08-12-2008 06:56 AM

Autofill PM from form.
 
Hi guys,

I was just wondering if any of you coders out there would know how to accomplich this:

If I have an external page and want a member to send a different member a PM I can achieve it like this using chdir() :

PHP Code:


// I have done some query here.

$id $row['userid']; 
$name $row['username'];

echo 
'<a href="../forums/private.php?do=newpm&amp;u='.$id.'">Send '$name.' A PM</a>'


Thats all fine and dandy. However, if I wanted to send a PM to the user that will autofill the PM text area in private.php from a text area in my external page how would I do it? Is this possible to achive without modifying vB. i.e is there a way of using $_POST and the url to achieve this?

Any ideas would be very much appreciated.

Kind regards

RLShare 08-12-2008 07:02 AM

If your forcing the user to send a message to a certain user and want to fill in the text area for them. Why not use the PM Datamanager in your script to send a PM straight from your script?

PHP Code:

$pmdm =& datamanager_init('PM'$vbulletinERRTYPE_ARRAY);

    
$pmdm->set_info('savecopy',      0);
     
//^^^Set to 1 to save a copy in the senders outbox
    
$pmdm->set_info('receipt',       0);
    
$pmdm->set_info('cantrackpm',    0);
    
$pmdm->set_info('parentpmid',    0);
    
$pmdm->set_info('forward',       0);
    
$pmdm->set_info('bccrecipients''');
    
$pmdm->overridequota true;
    
$title="Title.";
    
$message="This is a message [b]YOU CAN ADD BBCODE[/b]";
    
$iconid=0;
    
$pmdm->set('fromuserid'$userid);
    
$pmdm->set('fromusername'$username;
    
$pmdm->setr('title'$title);
    
$pmdm->set_recipients("USERNAME OF RECIPIENT"$permissions'cc');
     
// ^^username of the person/persons to send PM to
    
$pmdm->set_recipients(''$permissions'bcc');
    
$pmdm->setr('message'$message);
    
$pmdm->setr('iconid'$iconid);
    
$pmdm->set('dateline'TIMENOW);
    
$pmdm->setr('showsignature'$iconid);
    
$pmdm->set('allowsmilie'$iconid );
    
$pmdm->save(); 


noj75 08-12-2008 07:06 AM

Thanks for you extremely quick reply.

How would I implement the script above? Sorry, not a genius at PHP but know just enough to get me by.

Could you, by any chance, give me a quick example of how to integrate it?

Very much appreciated RLShare.

RLShare 08-12-2008 05:34 PM

As long as you have 'global.php' included you would do it just as I posted it where ever you wanted to send a pm.

You would need to change the $title , $message , fromuserid , fromusername and Set recipients at the very least.

Everything else is optional for you to change if you want and are pretty self explanatory, they all coinside with options that are available when you send a PM from the private message center in VB.


All times are GMT. The time now is 02:02 PM.

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.01477 seconds
  • Memory Usage 1,732KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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