You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a customer of mine who runs a forum on their D8 site I'm looking for a solution to allow users to subscribe to entities and get notified when new comments are submitted.
Looks like the message stack is what I need and message_subscribe is the right approach. That requires the flag module which seems to be working, at least I get the subscribe records in the database when users do subscribe to entities.
But no messages are created when a new comment gets submitted.
Now I'm wondering if there is something special on how to configure all that or if it's simply that either flag or message stack is not quite ready yet.
The text was updated successfully, but these errors were encountered:
The message stack provides everything but the logic to actually create the messages. This is typically done in a site-specific way using hook_ENTITY_TYPE_insert/update(). I think the message subscribe module should provide an example module that demonstrates this.
Here's an example:
functionmymodule_node_update(EntityInterface$node) {
/** @var \Drupal\message\MessageInterface $message */$message = \Drupal::entityTypeManager()->getStorage('message')->create([
'uid' => $node->getOwnerId(),
// This is the message template ID that should be used.'template' => 'my_message_template',
]);
$subscribers = \Drupal::service('message_subscribe.subscribers');
$subscribers->sendMessage($node, $message);
}
For a customer of mine who runs a forum on their D8 site I'm looking for a solution to allow users to subscribe to entities and get notified when new comments are submitted.
Looks like the message stack is what I need and message_subscribe is the right approach. That requires the flag module which seems to be working, at least I get the subscribe records in the database when users do subscribe to entities.
But no messages are created when a new comment gets submitted.
Now I'm wondering if there is something special on how to configure all that or if it's simply that either flag or message stack is not quite ready yet.
The text was updated successfully, but these errors were encountered: