as I am currently working on: https://drupal.org/sandbox/baumeier.it/2078043
I have a few thoughts:
to send messages to multiple recipients I currently do the following:
- get a list of people who shall receive the message(vbo view for flagged users, or users from user_relationship)
- loop through the list and create a message for each user, set the uid of the message to the receiver's uid
- create different view filtering by uid of the current logged in user
et voilà, message streams with receiver limitations. I can even send a message to all users if I set the uid to 0 and have a view listing all messages with uid 0.
This works really great, but I guess it's not how it should have been used in he first place. One alternative would be to reference the "friends" of a user in a entityreference field with multiple values, but I have a really bad feeling about performance here.
My suggestions would be to completely decouple the authorship of a message from message (remove the uid field from messages table) and let that handling (if needed) be solved by the fields of a message type (most of the time I don't even use that field at all for creating the message text - most of the referenced entities have a own ownership field/ author information). If not one could always add a reference to the author.
The next step would be to create a n:m table mapping the messages to the receivers. I guess this can already be done by entityreference though I don't know how much overhead it would add compared to doing it manually.
I would like to hear your thoughts on this :)
Comments
Comment #1
amitaibuHave you looked at Message subscribe module ? Isn't it doing what you are looking for?
Comment #2
Andre-Bprobably related: #1757060: Grouping messages by user
I will write more on this topic once I got message notification center published (which will hopefully ship with some best practice examples)
Comment #3
bluegeek9 CreditAttribution: bluegeek9 as a volunteer commented