Hi!

If enybody know how to integrate appbar with privatemsg module? It would be nice to see new messages in alerts:)

Comments

icecreamyou’s picture

Title: integration with privatemsg » integration with Application Toolbar (Appbar)
Project: Application Toolbar (Appbar) » Privatemsg
Version: 6.x-1.x-dev »
Component: User interface » Code

Moving to Privatemsg. The (very simple) API is here. Examples of integration are here.

Essentially, the only code required to integrate with Appbar is to insert code like this in places where an alert would be advantageous:

if (module_exists('appbar')) {
  $message = t('!user sent you a private message', array('!user' => theme('username', $sender_account)));
  $alert_type = 'privatemsg-receipt';
  appbar_set_message($message, $alert_type, $recipient_account->uid);
}

And then this hook should be added to specify what each alert type is for so users can turn them on or off:

/**
 * Implementation of hook_appbar_id().
 */
function appbar_defaults_appbar_id() {
  return array(
    'privatemsg-receipt' => t('Privatemsg receipt (alerts recipient)'),
  );
}
barylov’s picture

Thank You! works great! I must learn some PHP;)

icecreamyou’s picture

Issue tags: +Appbar

Tagging to make this easier to find.

berdir’s picture

Status: Active » Fixed

I have created a help page with an untested example code, see http://drupal.org/node/646518. Please test and update the page if necessary.

@IceCreamYou: If you want, feel free to add the code to your appbar_default module.

icecreamyou’s picture

@Berdir, appbar_default is intended for core modules. I don't intend to add direct support for other contrib modules since each one should integrate with Appbar individually. However, your solution is fine for now -- Appbar integrates with Rules, Trigger/Actions, and Activity in order to support as many modules as possible, and hopefully soon that integration will be strengthened to the point where explicit integration with Appbar is not usually even necessary.

Status: Fixed » Closed (fixed)
Issue tags: -Appbar

Automatically closed -- issue fixed for 2 weeks with no activity.