14

Using Heartbeat I have been able to effectively make streams of user activities through Rules triggers. However I would like to be able to have users notified of new activities, and keep a count of the number of new activities like in facebook, or even similar to new email counts in most email systems.

In Drupal 6 there were a few modules which could achieve this well, however how can this be done in Drupal 7?

I have done quite extensive research on this but am unable to find the right module at this point: There's the User Notifications and Notifier modules, which would be the perfect solutions except only D6 versions exist. There's Notifications which cannot be integrated with any activity logging module since it lacks proper Rules support. Two interesting implementations are Appbar and Taskbar which provide dropdown trays with lists of activities, but don't count the number of new activities and no longer integrate with Rules. Finally DLike is great as a dynamic counter, even though at the moment it only counts Flags and provides a link to a list of the flagging users. Perhaps with some tweaking it could be used via Flags Rules integration to track recent (flagged) activities and link to a list of these recent activities.

Is it possible to achieve functionality similar to this in Drupal 7? facebook

4

Approach 1: Menu Badges

Use the Menu Badges module to add such notifications to any menu item and/or menu tab of your choice. Here are some details about it (from its project page):

Provides a method for adding iOS-style badges to menu items. (see screenshot)

enter image description here

Adding Badges to Menus

Once enabled, go to Administration > Structure > Menus, and click "list links" next to the menu containing the target item. Click "edit" next to the item and select the badge to display with the Display Menu Badge select box.

Adding Badges to Tabs

For adding badges to menu tabs, there is a tab under Administration > Structure > Menus called "Tab Menu Badges". Search for the menu router path of the tab you want to alter, then select a badge from the corresponding select box.

Badge Types

The module includes five example badges, and new badges can be created easily with Views. Modules can also supply their own badges with a hook implementation. See the README.txt file for details.

Because of how it integrates with the Views module, you basically reduce the solution for any type of notification to something like "Just create an appropriate view of it".

Video tutorials:

Approach 2: Message stack

Use the Message Stack, which consists of these modules (quotes are from the module's project page):

  • Message:

    The Message module is the core of the message stack. It enables logging and displaying system events in a number of different use cases. Events that are recorded over time are sometimes call activity streams. Exportable messages subtypes can be created for different use cases with custom fields and display (view) modes.

  • Message Notify.

    This module provides a method for sending a message via a notifier plugin. Message Notify comes with plugins for email and SMS and may be extended to other transport mechanisms as required.

  • Message Subscribe.

    With this module, users who subscribe to content will be notified when events occur that involve that content. The module leverages the Flag module, which provides a subscribe functionality to users.

These are the basic components and dependencies of the message stack:

enter image description here

Quite a few popular Drupal distributions already adopted to this Message Stack, such as such as Commerce Kickstart, Drupal Commons, ERPAL and Open Atrium.

If you want to have a closer look at the Message Stack in your own environment, then experiment a bit with the Answers module (disclosure: I'm a co-maintainer), together with the Answers Notification sub-module, which allows logged in users to subscribe to selected questions, so that they receive notifications (using the Message Stack) when Questions receive Answers.

And the Message Stack will make you well positioned for Drupal 8 also (because of he modules' object orientated architecture). Even though there is no such a thing as 8.x-dev yet, the Message code repository already does contain something already (not yet for the 2 other modules though). I assume the wip part of the branch name stands for 'Work In Progress'.

  • will make you well positioned for Drupal 8 also. you mean in the future? I see none of the message modules have a Drupal 8 version yet, not even a dev. – No Sssweat Oct 29 '15 at 15:52
  • 1
    Hey @NoSssweat ... I slightly extended (then end of) my answer to clarify the D8 part of it. – Pierre.Vriens Oct 29 '15 at 17:13
  • Thank you very much for your kindness reply @Pierre.Vriens, i will check all the related documents hoping that i will have a clear idea about the message stack... – Charbel El Azzi Oct 29 '15 at 22:26
  • 1
    i mean that i am familiar on how to make notification system work between the users on my website and now i learned more about message stack which of i am glad, but i am still confused on how i can design such drop down notification menu... – Charbel El Azzi Nov 1 '15 at 4:53
  • 1
    Another example to understand more my issue: Have a look to the drop down menu when you hover over the shopping cart in the commerce kickstart 2 website (if you are familiar with kickstart distribution)... such drop down system i am looking for in my question... thanks again for your time and effort dear @Pierre.Vriens, God bless you. – Charbel El Azzi Nov 1 '15 at 4:53
3

There's a relatively new pair of modules that I think would be great to use for this: Message and Message-notify.

Message is basically a framework for creating "messages", which in your case would be notification items. One cool thing is that these are actually all created as entities, so it would be easy to show then in a dropdown block, have an All Notifications page, as well as have a custom field or flag on them that indicates whether they've been seen (or are new). You can then connect this to email notifications with the Message-notify module.

Note though that integrating this into your site would be a development task more than a site building task. The module has a good API that can be used in appropriate hooks, etc to create messages when desired, but I'm not sure how the Rules integration is going.

3

For real time integration you can use nodejs module.

This module integrates Node.js with Drupal.

It provides an API that other modules can use to add realtime capabilities to Drupal, specifically enabling pushing updates to open connected clients.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.