You are here

function og_activity_heartbeat_activity_log in Heartbeat 6.4

Implementation of hook_heartbeat_activity_log().

File

modules/og_activity/og_activity.module, line 115

Code

function og_activity_heartbeat_activity_log($heartbeatactivity, $args) {

  // Most of the time nid is a group post and nid_target the group, sometimes nid_target left empty.
  // In some cases the nid is the group id, leaving the nid_target empty.
  $in_group = (int) db_result(db_query_range("SELECT 1 FROM {og_ancestry} WHERE (nid = %d OR group_nid = %d OR group_nid = %d)", $heartbeatactivity->nid, $heartbeatactivity->nid, $heartbeatactivity->nid_target, 0, 1));
  if ($in_group) {
    db_query("UPDATE {heartbeat_activity} SET in_group = 1 WHERE nid = %d AND nid_target = %d ", $heartbeatactivity->nid, $heartbeatactivity->nid_target);
  }
}