Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 08-12-2008, 07:56 AM
noj75 noj75 is offline
 
Join Date: Nov 2004
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 08-12-2008, 08:02 AM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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(); 
Reply With Quote
  #3  
Old 08-12-2008, 08:06 AM
noj75 noj75 is offline
 
Join Date: Nov 2004
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 08-12-2008, 06:34 PM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:08 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03705 seconds
  • Memory Usage 2,201KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete