The problem:
Rules events are missing. EVENT 1. user flagged a statuses and EVENT 2. user flagged a fbss_comment. Everything is available, just need to add these events. Status updates are created by statuses module. I want to log both events mentioned above using message module, but I Cannot unless and until this event is created. Conditions and actions are available by default.
Important Note:
Statuses is not compatible with flag 3. It works with flag 2. When you install flag 2, status updates will show "like" button in status updates and status comments. Not only this, but you will also be able to see status updates of users you are following, in your status stream, when flagged with "follow" flag. Moreover, if you see rules conditions and actions, you will find out that "fbss_comment is flagged" and "statuses is flagged" and similarly actions "flag a statuses" and "flag a fbss_comment" are available. I am getting a feeling that the solution might be hidden within the statuses module folder and its submodules. Just need someone who has an eye to see it. Someone said, "Everything is possible with drupal"
What I tried?
Starting with "user flagged a fbss_comment" event, I went to file fbss_comments_rules.rules.inc in the sub-module fbss_comments. Under function fbss_comments_rules_rules_event_info()
I pasted,
'fbss_comments_flag' => array(
'label' => t('User flags a comment on a status'),
'group' => t('Statuses Comments'),
'variables' => array(
'comment' => array(
'type' => 'fbss_comment',
'label' => t('The status comment.'),
),
),
),
Then under function fbss_comments_rules_add_action
I added,
function fbss_comments_rules_flag_action($cid, $sid, $message, $uid) {
fbss_comments_flag_comment($cid, $sid, $message, empty($uid) ? $GLOBALS['user']->uid : $uid);
}
Note: I do not know what I was doing. I just did it as a trial and error.
Message type Export
{
"name" : "scomments_liked",
"description" : "Status comments liked",
"argument_keys" : [ "@scomments_liked_user", "!scomments_liked_statuses_url" ],
"argument" : [],
"category" : "message_type",
"data" : {
"token options" : { "clear" : 0 },
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
},
"language" : "",
"arguments" : null,
"message_text" : { "und" : [
{
"value" : "@scomments_liked_user liked your comment on the \u003Ca href=\u0022!scomments_liked_statuses_url\u0022\u003EStatus Update\u003C\/a\u003E",
"format" : "plain_text",
"safe_value" : "@scomments_liked_user liked your comment on the \u003Ca href=\u0022!scomments_liked_statuses_url\u0022\u003EStatus Update\u003C\/a\u003E"
}
]
},
"rdf_mapping" : []
}
Rules Export
{ "rules_statuses_comments_flag" : {
"LABEL" : "Statuses comments flag",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "statuses" ],
"REQUIRES" : [ "fbss_comments_rules", "rules" ],
"ON" : { "fbss_comments_flag" : [] },
"DO" : [
{ "fbss_comments_rules_load_action" : {
"USING" : { "cid" : [ "comment:cid" ] },
"PROVIDE" : { "comment_loaded" : { "comment_loaded" : "Loaded status comment" } }
}
},
{ "entity_query" : {
"USING" : {
"type" : "user",
"property" : "uid",
"value" : [ "comment-loaded:uid" ],
"limit" : "1"
},
"PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
}
},
{ "entity_create" : {
"USING" : {
"type" : "message",
"param_type" : "scomments_liked",
"param_user" : [ "entity-fetched:0" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "data_set" : {
"data" : [ "entity-created:arguments:scomments-liked-user" ],
"value" : "[site:current-user]"
}
},
{ "data_set" : {
"data" : [ "entity-created:arguments:scomments-liked-statuses-url" ],
"value" : "[comment:comment-status-url]"
}
}
]
}
}
Rules Export based on Nial Murphy's answer
{ "rules_user_flagged_statuses" : {
"LABEL" : "User flagged statuses update",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "statuses" ],
"REQUIRES" : [ "fbss_rules", "rules", "flag" ],
"ON" : { "flag_flagged_like" : [] },
"DO" : [
{ "fbss_rules_load_action" : {
"USING" : { "sid" : [ "flagged-status:sid" ] },
"PROVIDE" : { "status_loaded" : { "status_loaded" : "Loaded status" } }
}
},
{ "entity_query" : {
"USING" : {
"type" : "user",
"property" : "uid",
"value" : [ "status-loaded:sender" ],
"limit" : "1"
},
"PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
}
},
{ "entity_create" : {
"USING" : {
"type" : "message",
"param_type" : "flagged_status",
"param_user" : [ "entity-fetched:0" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "data_set" : {
"data" : [ "entity-created:arguments:statuses-flagged-user" ],
"value" : "[flagging-user:name]"
}
}
]
}
}