You are here

function heartbeat_rules_default_action in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.4 modules/heartbeat_rules/hrules.rules.inc \heartbeat_rules_default_action()

Action Implementation: Log an activity Default action for most common heartbeat message activities

@ToDo figure out what params mean / can do

Parameters

array $settings:

array form:

array with two arrays (set_info and variables):

3 string references to 'heartbeat_rules_default_action'
heartbeat_rules_defaults in ./heartbeat.rules_defaults.inc
Implementation of hook_rules_defaults
og_activity_rules_defaults in modules/og_activity/og_activity.rules_defaults.inc
Implementation of hook_rules_defaults
shouts_rules_defaults in modules/shouts/shouts.rules_defaults.inc
Implementation of hook_rules_defaults

File

./heartbeat.rules.inc, line 253

Code

function heartbeat_rules_default_action($settings, $form = array(), $event_info = array()) {
  $data = array();
  if (is_array($settings)) {

    // Normal form values
    $data['uid'] = $settings['uid_param'];
    $data['uid_target'] = $settings['uid_target_param'];
    $data['nid_target'] = $settings['nid_target_param'];
    if (is_numeric($data['nid_target']) && $data['nid_target'] > 0) {
      $node = node_load($data['nid_target']);
      $data['node_type'] = $node->node_type;
    }
    $data['message_id'] = $settings['message_id_param'];

    // Relational message of heartbeat messages
    $message = heartbeat_load_message($data['message_id']);
    $data['message'] = $message->message;
    $data['message_concat'] = $message->message_concat;
    $data['variables'] = $settings['variables_param'];
  }
  heartbeat_log($data);
}