Last updated November 30, 2009. Created by Berdir on November 30, 2009.
Log in to edit this page.
The following code sample shows you how to integrate Privatemsg with the Application Toolbar.
<?php
/**
* Implements hook_privatemsg_message_insert().
*
* Adds a notification for each recipient when a message is sent.
*/
function yourmodule_privatemsg_message_insert($message) {
$text = t('!user sent you a private message', array('!user' => theme('username', $message['author'])));
$alert_type = 'privatemsg-receipt';
foreach ($message['recipients'] as $recipient) {
appbar_set_message($text, $alert_type, $recipient->uid);
}
}
/**
* Implementation of hook_appbar_id().
*/
function yourmodule_appbar_id() {
return array(
'privatemsg-receipt' => t('Privatemsg receipt (alerts recipient)'),
);
}
?>More information:
Privatemsg API documentation: http://blog.worldempire.ch/api
Application Toolbar API documentation: http://drupal.org/node/546536#api
Application Toolbar Integration examples: http://drupalcode.org/viewvc/drupal/contributions/modules/appbar/appbar_...
Comments
Is it fair to ask someone to
Is it fair to ask someone to prepare ready-made module for the purpose?
I spent a few hours till now cause of my PHP knowledge and i think that it wont take more then few min for someone else :-(
Thank you in advanced...