How to show message view containing own and following activity? I have created a message view using the Message module. I want this view to show the current user activity and activity of the user he is following using the "follow" flag (user). i.e own + following.

The Message module comes with a "message subscribe" flag, but I do not want to use that. What should be the setting of my view particularly the relationship and contextual filters?
About the Message module and user activity

Even though you're question doesn't really say so, I'm assuming that: 


"activity" in this question is about message instances created by the Message module, targeted to the current user.
"activity of the user he is following" is about message instances target to the current user (also), though they are about events related to any of the followed users (indicated by your follow-flag).


If these assumptions are correct, then your question is about creating a view of various flavors of messages (typically created using various Message Types), which are all targeted to the current user.

Creating a view about Messages by user

Add a new view


View name "Messages by user".
Show Message.
Type All.
Create a page (not a block)


Create a table display of this view

For this question here, you only need a single table display, of All messages.

To differentiate this "All", think of additional displays you might want to add later on, such as:


Read messages
Unread messages


Add Contextual Filters


Message: User uid, and for "When the filter value is NOT in the URL" use "Provide default value" with Type "User ID from logged in user".


Add Relationships

"Message: User uid" will result in the messages targeted to the current user, so that one you need for sure.

I suggest you create a first display only using the above relationship (to check the results you get so far). Then clone this display into another one, in which you add another relationship like "Flags: follow (by current user)" (assuming that follow corresponds to your follow-flag). By swapping between the 2 displays, you can decide which one you really want, or just keep both.

Add Fields


Message: Message ID (Msg ID)
Message: Timestamp (Created on)
Message: Render message (Get text) (Text)
(User) User: Name (User), and use "Exclude from display" for this field, which is only needed to add a "Global: Text area" to the views headers which contains something like Messages for user [name].


Add Sort criteria


Message: Timestamp (desc)


Further Refinements


Filter criteria: none
Page settings:


Path: /user/%/messages
Menu tab: Messages



Make the Messages manage-able

If you complete the above steps, you'll have a view that shows all relevant messages ... and that's really it. It won't be obvious for a user to remember which messages have been read already, and which ones are new (= unread). Try it for yourself (to experience the pain ..).

To implement a facility to mark messages as read/unread, just perform the steps explained in "How to allow users to manage their own Message Stack messages?", which can be summarized like so:


Create a flag (using the the Flag module).
Create a view 'Messages by user' (= improved version of the view specifications described above).
Use Rules to flag/unflag messages.
Trigger the Rules Component to mark messages (using the VBO module).
Create notifications about Unread Messages (using the "Menu Badges" module). So that whenever a new message gets created, the user gets a notification in the format of an iOS-like (red) badge with the number of unread messages.


Fruit of your labor

If you follow the above steps, the result of it is something similar to an eMail client inbox, whereas the eMail "messages" are not real eMails, but instances of messages created by the Message module.