I have created few activity logs using the Message module. All works ok, but when I try to create a message type for example "username started following you on github". When setting up the rules for this message type, I am not able to understand how to achieve this.
What should happen?
Message must be logged for the "User who ‘Is flagged’" user and at the same time the username token must be replaced by the "User who ‘Flagged it’" user. The problem is that this is not happening.
What is happening?
When the message is logged for "User who is flagged", the username is also replaced by "User who is flagged" user and vice versa. Obviously this is not what is required.
Export of "User Following" message type
{
"name" : "user_following",
"description" : "User following",
"argument_keys" : [],
"argument" : [],
"category" : "message_type",
"data" : {
"token options" : { "clear" : 0 },
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
},
"language" : "",
"arguments" : null,
"message_text" : { "und" : [
{
"value" : "[message:user:name] started following you on [site:name]",
"format" : "plain_text",
"safe_value" : "[message:user:name] started following you on [site:name]"
}
]
},
"rdf_mapping" : []
}
Rules for above message
{ "rules_started_following" : {
"LABEL" : "Started_following",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "user" ],
"REQUIRES" : [ "rules", "flag" ],
"ON" : { "flag_flagged_follow" : [] },
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "message",
"param_type" : "user_following",
"param_user" : [ "flagged-user" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
}
]
}
}
Note: It is about rules setup for message type when you select data-selectors in rules setup.
Another example is for "xyz mentioned you on github". Same problem goes here. Here username replaced by xyz and it was logged for xyz as well. It should not happen.
If abc user was mentioned by the xyz user, then the above message or notification must be received by the abc user and not the xyz user. Like normally you receive a notification on other websites when someone follows you or mentions you.
Export of "Mentions" message type
{
"name" : "log_mentions",
"description" : "Log mentions",
"argument_keys" : [],
"argument" : [],
"category" : "message_type",
"data" : {
"token options" : { "clear" : 0 },
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
},
"language" : "",
"arguments" : null,
"message_text" : { "und" : [
{
"value" : "[message:user:name] mentioned you",
"format" : "plain_text",
"safe_value" : "[message:user:name] mentioned you"
},
{
"value" : "\u003Cp\u003E[message:user:name]\u003C\/p\u003E\r\n",
"format" : "full_html",
"safe_value" : "\u003Cp\u003E[message:user:name]\u003C\/p\u003E\n"
}
]
},
"rdf_mapping" : []
}
Export of Rules for above message
{ "rules_test_rule" : {
"LABEL" : "test rule",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "statuses_tags" ],
"ON" : { "statuses_tags_user_was_tagged" : [] },
"IF" : [
{ "statuses_tags_has_specific_tag_condition" : { "status" : [ "status" ], "type" : "user", "tag" : "[account:name]" } }
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "message",
"param_type" : "log_mentions",
"param_user" : [ "account" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "data_set" : {
"data" : [ "entity-created:field-message-mentioning:name" ],
"value" : "[status:sender]"
}
}
]
}
}
Problem: When using it, if I mentioned Pierre in a post, the output is, "Pierre mentioned you" and the message is also logged for Pierre.
Statuses Sub-Modules: I am using all sub-module except following:
Statuses Domain Access, Statuses Mollom, Statuses Notifications and Statuses Userpoints. It is important to tell here that Flag 3 does not work with statuses module, Flag 2 does. Good thing is you do not want flag module to workout this problem. I am using flag 2 as I want the "like" button and follow functionality for status updates.
Note: I created the field of machine name "field_message_mentioning" Label: "mentioning" Type: "Entity Reference (User)" Widget: "Autocomplete". I have tried lot of things and spent hours, but I do not know what I am doing. I just read online and try to apply.
Hope you understood. Please read the whole explanation in the context of rules setup for message type. If there is any confusion, please ask me before answering.