Change the rendered output of a Message entity I'm using the Message module to create messages on certain events, for example, on forum node creation:

"X has posted a new thread in the Y forum."

I've got a view that spits all of these out.

I now want to create a new view that shows the same messages, but in this view, I want to change the output of the above message to:

"You have posted a new thread in the Y forum."

Every time the node's author matches the currently authed user.



Now my thoughts would be that I could somehow intercept the output of either the token (X) or override the whole message entity template, but I'm not entirely sure how to go about this. 

Another thing I tried was to create a new user token, called "Username or you", which would output "you" if the associated message node matched the authed user, or the username if not. However, I'm not sure how I could get the message object. It's worth noting that I have the token:

[message:field-forum-post:author:username_or_you]


So if I could follow the trail back to "message" and get the message id, I'd be all set.

Any pointers?
See the Messaging documentation, specifically this overview on new features. You likely want to override the tokens provided using a callback which is supported by the module:


  Callbacks: sometimes we can’t use the token system, for example if we
  need to show different results based on the value of _two different
  fields. This is an advanced feature, which is meant for developers,
  and is documented in the module.


I've not done this myself yet, but I've used the Message module and Views -- digging through the module and documentation should get you there now that you know it's possible.

From the message_example README it sounds like you want an activity stream:


  The UAS (User activity stream) view is dependent on Panels, as it uses
  "Panel fields" as a row plugin, along with the Message's partials.


Which you should be able to look at for inspiration in the example module.