By iterator on
Hi there..
Is there a way to send a privatemsg message with my own module? Is there a hook or something like that?
Hi there..
Is there a way to send a privatemsg message with my own module? Is there a hook or something like that?
Comments
send privatemsg message
Anyone?
Yes there is
In your own module, you need to get the user objects of both the sender and recipient.
There is a function called _privatemsg_send() it takes the following parameters:
_privatemsg_send($sender,$recipient,$subject,$message_body,$format,$thread);
$format I am not 100% sure on, but I have it set to 1 and that works fine.
To get the correct value for $thread I run the following:
That should help you out.
FiveRDesign - UK Drupal Consulting, Development, Custom Modules & Support
MySweetShadow - Heavy Metal Blog, Drupal & SEO
This is for D5. For D6, use
This is for D5.
For D6, use the following function: http://blog.worldempire.ch/de/api/function/privatemsg_new_thread/1
You can also reply to a existing thread, see http://blog.worldempire.ch/de/api/function/privatemsg_reply/1