This module is a plugin for the notifications module allowing 'privatemsg received' alerts through the notifications and messaging framework. The messaging template is available to be configured at "messaging/template/edit" under 'Privatemsg notifications'.

At the moment it outputs the privatemsg data as tokens ([privatemsg-author], [privatemsg-subject], [privatemsg-body]....and so on) which you will find in the template configuration.
Each users subscription must still be saved as I didn't write that into any ui or admin section.

A subscription for this event would look something like this:

$subscription = array(
'uid' => $user->uid, //***SUBSCRIBING USERS UID***
'module' => 'privatemsg_notify',
'type' => 'recieved',
'event_type' => 'privatemsg',
'send_interval' => 0, //or other, or user/site default
'send_method' => 'mail', //or other, or user/site default
'cron' => 1,
);
notifications_save_subscription($subscription);

any questions, fire away.

Aerostop

CommentFileSizeAuthor
#5 privatemsg_notify.zip3.24 KBtayzlor
#2 privatemsg_notify.zip2.29 KBAnonymous (not verified)
privatemsg_notify.tar_.gz1.62 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Category: support » feature
Anonymous’s picture

FileSize
2.29 KB

Sorry, a couple of additions....

The 'event' should have
'save' => 1,
'queue' => 1,
added to the array. This will ensure notifications are triggered on the event.

Also I added a call to process 'immediate' rows in the queue, of module type 'privatemsg_notify,' to dispatch notifications that would otherwise have to wait until the next cron run.

Jose Reyero’s picture

Status: Needs review » Needs work

@ssherrie,

This looks great. Some notes for possible improvements:
- The vent parameters just need to include the privatemsg id, then the full message can be loaded using _notifications('event load'. Loading it into $event->objects will make it available for tokens.
- Then we could have a single event for all recipients, we just need to addapt the notifications query.
- The _notifications('names' ) hook is about to be deprecated, you can define all data in _notifications('event types') and it all will be handled automatically.

I think it would be great if this would get into privatemsg. Anyway, if there's not response here, this will be welcomed too in this other project (I'd add you to the cvs list so you can maintain it there), http://drupal.org/project/notifications_extra

jmonster’s picture

Do you have any instructions on how to install this mod, is it the same way as pm_email... I tried putting it in the privatemsg directory, had the template msg edited under notification after enabling it but it doesnt seem to send the emails...any ideas

tayzlor’s picture

FileSize
3.24 KB
tayzlor’s picture

Added a subscriptions UI to this to allow users to turn on / off email notifications for privatemessages at -

user/[uid]/notifications/privatemsg .

has not been fully tested, so may be a couple of bugs, but tried it out quickly and it seems to work ok.

@jose, was not sure there can be a single event for all receipients, i had a look, but the notifications module does a single row insert into the {notifications_queue} table after the 'query' case is called in hook_notifications().

if we have multiple recipients theres needs to be x rows added to this table in order for a notification to be sent to each recipient, hence creating multiple events allows this to happen. Could not see how the query could be altered to allow only the one event and this could be done straight out of hook_notifications? but maybe you have a better idea!!

did not touch the other suggestions as yet as waiting to see if 1 event could be generated instead of x number of events

thanks
graham.

Anonymous’s picture

Thanks for picking this up and improving it. Honestly I didn't think anyone was interested, which I thought was weird.

I ended up scrapping notifications and messaging and going with a simpler, but always instant, email notification system since I didn't need all the extra messaging 'channels'. Also I bastardized privatemsg when I hit an immovable wall while trying to implement some special stuff.

Hope it works for you guys.

BenK’s picture

Subscribing...

entrigan’s picture

Version: 6.x-1.0-rc2 »
Assigned: » Unassigned

Is this destined to be incorporated in the project?

Berdir’s picture

Very unlikely, we already provide a email notify sub-module. It could become part of the notifcations_extra project as outlined above, but there hasn't been any progress here for quite some time.

parashutiki’s picture

Thanks. It's work fine

BenK’s picture

Hmmm.... interesting. I want to take a closer look at this in conjunction with Private Message for D7. From what I understand Messaging and Notifications are being significantly streamlined and improved for D7.

One possibility... Instead of using Notifications (which adds a lot of subscription complexity), I'm wondering about just using Messaging. Might it be possible to adapt PM Notify with an option/setting to send using the Messaging Framework? There could be some advantages: For instance, the D7 version of Messaging has a messaging_sendgrid module that is a wrapper for the Sendgrid service (sendgrid.com).

One other possibility: Notifications allows you to disable to default UI and define your own custom UI. What if PM Notify defined it's own Notifications UI? It might be possible to do a very simple UI and then allow developers to add other Notifications settings to it as needed.

Thoughts?

--Ben

BenK’s picture

Title: Notifications plugin for privatemsg (6.x) » Messaging and/or Notifications integration
Version: » 7.x-1.x-dev

Since development on this has stalled in D6 (and the initial thread creator is no longer pursuing this), I'm changing the version of this thread to D7. I think more is possible here in D7 and I'd like to take a closer look.

--Ben

sgp913’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

Bump!

On the messaging module's page they claim support for integration with privatemsg, FYI.

Berdir’s picture

What messaging contains is a way to send notifications as private messages (They did, not sure if they still do). This issue is about integration with Notifications when a private message is sent.

ivnish’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)
andypost’s picture

Status: Closed (outdated) » Needs work

D7 is not yet outdated