1

I am using message module to record user activity on the site and displaying it through views. I am using rules module to trigger actions on certain events and show the relevant message.

How I can show picture of the user who triggered the event?

For example: When my question is liked by clive, I receive a message notification that "Clive liked your question". I only see a plain text. How to show the user picture?

  • How do you "receive a message"? Is that via some eMail (triggered by Rules or so), or is that an extra row that gets added in your view that displays the "Message" entities? Also, what do you have available in your Drupal site that contains such user picture? – Pierre.Vriens Apr 20 '17 at 16:10
  • @Pierre.Vriens Via email as well as on site after a rule is triggered. When you create a message type, you have 2 textareas, Subject and Body. I am talking about the body. I did not understand the last question. – Umair Apr 21 '17 at 12:00
  • Why did I receive a -20? There is a message as well, "user was removed". I asked another question regarding "How to convert flag link text to button". Do you know about that? – Umair Apr 21 '17 at 12:03
  • about my last question: what would be the url to be used if you want to browse such picture? or is it some image field of eg the user profile? – Pierre.Vriens Apr 21 '17 at 12:04
  • About your -20: you're not alone ... look at my profile (= -15). Has to do with some userid that got deleted (and which seemed to have voted a lot, so that are many upvotes of questions or answers that are now no longer upvoted by that user). About flag question: I saw that, but the closest I now of is like in my answer here, which I think you did not want to use. – Pierre.Vriens Apr 21 '17 at 12:07
1

Since you are using Rules to create your messages to be delivered, you can try to make the missing tokens available by using the Replacement patterns for each message type. Refer to the answer to What's the purpose of "Replacement tokens" of a Message type? for way more details on that (it explains how these Replacement tokens can be used to pass data available in Rules to the Message module).

With that, your only remaining challenge is to get access to the user picture in a custom rule. In D8 that picture has become a field also, but that's not the case in D7. Therefor you may get it to work in D7 also if you also use the user picture field module (which doesn't have an official D7 release yet, but about 11K reported installs sounds like it's a pretty stable module).

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.