function privatemsg_rules_reply in Privatemsg 6.2
Same name and namespace in other branches
- 7.2 privatemsg_rules/privatemsg_rules.rules.inc \privatemsg_rules_reply()
- 7 privatemsg_rules/privatemsg_rules.rules.inc \privatemsg_rules_reply()
Helper function for replying to a thread.
1 string reference to 'privatemsg_rules_reply'
- privatemsg_rules_rules_defaults in privatemsg_rules/
privatemsg_rules.rules.inc - Implements hook_rules_defaults().
File
- privatemsg_rules/
privatemsg_rules.rules.inc, line 405 - Hooks and callback functions for rules.module integration.
Code
function privatemsg_rules_reply($thread_id, $body, $author) {
rules_log(t('Writing reply to thread %thread_id from %author', array(
'%thread_id' => $thread_id,
'%user' => $recipient->name,
'%author' => $author->name,
)));
$result = privatemsg_reply($thread_id, $body, array(
'author' => $author,
));
if ($result['success']) {
rules_log(t('New message sucessfully sent, !link', array(
'!link' => l($subject, 'messages/view/' . $result['message']['thread_id']),
)));
}
else {
foreach ($result['messages']['error'] as $message) {
rules_log(t('Message not sent, reported error: !error', array(
'!error' => $message,
)), TRUE);
}
}
foreach ($result['messages']['warning'] as $message) {
rules_log(t('Warning message reported when trying to send message: !warning', array(
'!warning' => $message,
)), TRUE);
}
}