Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Send PMs (automatically)
Andreas
Join Date: Jan 2004
Posts: 6,863

Germany
by Andreas Andreas is offline 10 Jun 2005

If you want to (automatically) send a PM to a user, you can use the Class vB_Datamanager_PM.
This class makes sure that all values are correct, handles quota for the recipients, notification eMails, etc.

Example


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If anything goes wrong you can check for errors using

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This is an erray containing the errors.

If everything is OK

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This will send a PM to user newuser telling him
Hello.
I am a Bot and would like to give you a warm welcome
The message will appear to be coming from User Welcom-Bot (Userid 1234).

$botpermissions must be the permissions for the sending user, but can just be empty.
If you want to send PMs no matter if the PM box of the recipient is full or not:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If you want, you can set other options as well ($pmdm->set_info(...)):
  • forward = 1/0 if this is a forwarded PM, Default=0
  • savecopy = 1/0 to keep a copy if the PM in outbox, Default=0
  • receipt = 1/0 to request a read-receipt, Default=0
  • parentpmid = ID of the PM you are responding to (if applicable)

Furthermore you can specify ($pmdm->set(...)):
  • iconid = ID of the message icon the PM should carry, Default=0
  • showsignature = 0/1 Whether the signature should be shown or not, Default=0
  • showsmilie = 0/1 Wheter smilies should be parsed or not, Default=1

For multiple receipients just use user1;user2;useer3.

This How-To is (C) 2005 by KirbyDE and you are not allowed to redistribute it in any way without my explicit consent.

Last edited by KirbyDE; 01 Aug 2005 at 19:06..
Views: 34084
Reply With Quote
Comments
  #2  
Old 10 Jun 2005, 06:37
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
This is a FANTASTIC tutorial - people can make up a zillion hacks based on this How-To.
Reply With Quote
  #3  
Old 10 Jun 2005, 07:56
Logikos Logikos is offline
 
Join Date: Jan 2003
KirbyDE, That is great! I just love this.

Finaly the old vB.org is BACK!
__________________
Full Time PHP Developer
Please feel free to contact me if you have any paid work to be done.
Reply With Quote
  #4  
Old 11 Jun 2005, 04:09
Bad Bunny's Avatar
Bad Bunny Bad Bunny is offline
 
Join Date: Apr 2002
Wow! Lots of good stuff here. I'm so excited about this new release. Thank you so much for the tutorial, as it really does teach you something useful. Thanks!
Reply With Quote
  #5  
Old 12 Jun 2005, 07:05
VBCoder VBCoder is offline
 
Join Date: Jun 2005
Kirby,

Is there anyway we can get this info for the other classes?
Reply With Quote
  #6  
Old 13 Jun 2005, 08:17
eXtremeTim eXtremeTim is offline
 
Join Date: Jun 2002
Real name: Tim Yarbrough
Originally Posted by VBCoder
Kirby,

Is there anyway we can get this info for the other classes?
If I have time tommorrow I will post up one for the new reply class. Since I had a good deal of time working with it today. I now have my talkerbot hack fully using the new reply datamanager.
Reply With Quote
  #7  
Old 14 Jun 2005, 19:52
M1th's Avatar
M1th M1th is offline
 
Join Date: Jul 2002
To send PMs to more than 1 user:


Retrieving usernames:

To get a list of usernames from an array and output in the form of user1;user2;user3:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

replacing xx with usergroupid

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

To output the $pmto_users array into the format user1;user2;user3 you do:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Finally, sending the pm -repeat all the steps mentioned by KirbyDE but replace

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

with:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

[$pmtousernames would output to something like user1;user2;user3;etc]
__________________
Chamber of Secrets - The Ultimate Harry Potter Community!
Reply With Quote
  #8  
Old 27 Jun 2005, 07:41
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Real name: Matthew Gordon
The PM data manager seems to completely kill the page when I use this function. It just does a white page and no PM is sent.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I have since went back to using my old function which got the job done. I'll probably try fixing the version of the function that uses the data manager, but for now...
__________________
Along with Zachery, I make releases as GeekyDesigns. Please do not PM or IM me for support.
Reply With Quote
  #9  
Old 27 Jun 2005, 12:17
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
Originally Posted by Link14716

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Remove this line and it'll work
Reply With Quote
  #10  
Old 27 Jun 2005, 19:45
flup's Avatar
flup flup is offline
 
Join Date: Jan 2002
Real name: Joshua

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

What should that line be if it has to be send to the administrator with userid 1 (or just all administrators).
Reply With Quote
  #11  
Old 27 Jun 2005, 20:38
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Real name: Matthew Gordon
Originally Posted by KirbyDE
Remove this line and it'll work
I probably would have figured that out if it told me instead of blank paging me.
__________________
Along with Zachery, I make releases as GeekyDesigns. Please do not PM or IM me for support.
Reply With Quote
  #12  
Old 27 Jun 2005, 20:41
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
Suggest @ Jelsoft to call die('Class vB_Datamanager not defined') instead of just exit;
Reply With Quote
  #13  
Old 28 Jun 2005, 00:20
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Real name: Chris Murphy, BSc
Or just die

Satan
Reply With Quote
  #14  
Old 28 Jun 2005, 00:26
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
Hmm, die() without parameters does not produce any output as well, or am I wrong?
Reply With Quote
  #15  
Old 28 Jun 2005, 09:04
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Real name: Chris Murphy, BSc
No - I meant that you could suggest to Jelsoft that they could just die

They haven't fixed the Beta 3 issue yet :cry:

Satan
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 11:30.

Layout Options | Width: Wide Color: