6

I'm looking for a way to create a basic current user notifications system for my site, e.g.:

  • "some user" has created a new "group"
  • "some user" has joined your "group"
  • "some user" has posted a node in your "group"
  • "some user" has written a "review" for your "article"
  • "some user" has commented your "review"
  • etc...

I imagine this system as a simple menu link with a counter badge attached to it showing the number of new unread notifications just like this site or linkedin.com site.

When clicking upon this link current user will be directed to a page showing the user's new notifications and the counter will be then set to 0.

I believe what I need is the Heartbeat or Message module, combined maybe with Menu badges. But I'm not sure what to choose and how to start. Any advice?

closed as too broad by kiamlaluno Aug 5 '17 at 23:13

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

3

For real time messages, you will need the Node.js integration module. You can use Heartbeat, the Taskbar and the Message modules together to show notifications.

  • Hi thanks for the answer. What's the taskbar module? Also i think that only heartbeat supports nodejs for the moment. – Billy Apr 5 '13 at 7:52
  • I think that in your case you can use the Taskbar activity module. We have implemented this using the Rule, Message and Taskbar activity modules, together some custom code in one of our project (not real time). Since you want real time, and as you are saying heartbeat supports nodejs, you can try heartbeat. – nit3ch Apr 5 '13 at 8:58
  • I think nit3ch is right. You will need nodejs for real time processing or u can create one table to these entry and fetch data from this table. But while fetching the data u have to use cron job and run cron in every 1min or watever u desire.THere is an one module available for cron job "drupal.org/project/elysia_cron".It can give u flexibilty. I hope it will help u.. – Deepak Kumar Apr 5 '13 at 9:06
  • ok. will try these and get back if any problems. thanks – Billy Apr 5 '13 at 9:21
  • can't seem to work out the toolbar module. any basic help on how to configure and display it?? – Billy Apr 7 '13 at 18:03
3

Part 1 - Messages module

Use the Message module to create "Messages" for each of the message types (bullets) in your question, similar to what is detailed in the answer to "How to get notifications in a new window when using the Mentions module?".

The Message module uses so called "Message types" (which you have to configure within admin). It seems that you should just create 1 such Message type for each of the variations of messages in your question.

Part 2 - Make messages manageable

The Message module is great, but it doesn't really come with some UI where each user can manage (view, mark read, etc) their messages. That why you may want to also perform the steps explained in "How to allow users to manage their own Message Stack messages?", which can be summarized like so:

  1. Create a flag (using the the Flag module).
  2. Create a view 'Messages by user'.
  3. Use Rules to flag/unflag messages.
  4. Trigger the Rules Component to mark messages (using the VBO module).
  5. Create notifications about Unread Messages (using the "Menu Badges" module, further detailed below).

Part 3 - Menu Badges module

The Menu Badges module is all you need to add such notifications, which you can add 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".

However, there is a small caveat: if you really want the actual number (shown in the red circle) to be accurate, make sure you have some field in your view that will actually correspond to the "new" part of your question. To better explain this: have a look at the "tracker" view (disabled by default), which has the fields "Content:Has new content" and "Content:Has new comments". Those are 2 perfect fields to use if you want to use Menu Badges to get notified whenever there is new content, or new comments.

Video tutorials:

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