function commons_like_existing_node_like_messages in Drupal Commons 7.3
Indicate whether there is an existing message about a given user liking a specific node.
1 call to commons_like_existing_node_like_messages()
- commons_like_votingapi_delete in modules/
commons/ commons_like/ commons_like.module - Implements hook_votingapi_delete(). Delete a message when a user unlikes a node.
File
- modules/
commons/ commons_like/ commons_like.module, line 68
Code
function commons_like_existing_node_like_messages($acting_uid, $target_nids) {
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'message', '=')
->propertyCondition('uid', $acting_uid)
->propertyCondition('type', 'commons_like_user_likes_node', '=')
->fieldCondition('field_target_nodes', 'target_id', $target_nids, 'IN')
->execute();
if (!empty($query->ordered_results)) {
$mids = array();
foreach ($query->ordered_results as $result) {
$mids[] = $result->entity_id;
}
return $mids;
}
return FALSE;
}