You are here

friendlist_activity.rules_defaults.inc in Heartbeat 6.2

Rules' pre-configured rules.

File

user_activity/modules/friendlist_activity/friendlist_activity.rules_defaults.inc
View source
<?php

/**
 * @file
 * Rules' pre-configured rules.
 */
function friendlist_activity_rules_defaults() {
  $config['rules'] = array();
  $config['rules'] += friendlist_activity_default();

  // dsm('friendlist_activity_rules_defaults');
  return $config;
}

/**
 * Function to work with rules defined in friendlist
 */
function friendlist_activity_default() {

  // Friendlist
  // Add an action to the existing event "event_friendlist_add",
  // for a user relation TWO_WAY user1 -> user2
  // The separate action "friendlist_activity_rules_action" handles both loggings
  $config['friendlist_activity_rule'] = array(
    '#type' => 'rule',
    '#name' => 'friendlist_activity_rule',
    '#categories' => array(
      'heartbeat',
    ),
    '#set' => 'event_friendlist_add',
    '#label' => 'Heartbeat: Friendlist activity - log requester and requestee after they accepted both',
    '#active' => 1,
    '#weight' => '3',
    '#status' => 'default',
    '#conditions' => array(
      1 => rules_use_condition('rules_condition_relation_status_compare', array(
        '#settings' => array(
          'status_param' => 'TW_BOTH',
          '#argument map' => array(
            'status_post' => 'relation_status',
          ),
        ),
        '#weight' => 0,
      )),
    ),
    '#actions' => rules_use_action('friendlist_activity_rules_action', array(
      '#settings' => array(
        'event_param' => 'event_friendlist_add',
        'uid_param' => '[user1:uid]',
        'uid_target_param' => '[user2:uid]',
        'nid_target_param' => '0',
        'message_param' => t(heartbeat_event_messages('event_friendlist_add', 'message')),
        'message_concat_param' => t(heartbeat_event_messages('event_node_update', 'message_concat')),
        'variables_param' => heartbeat_event_messages('event_friendlist_add', 'variables'),
        '#eval input' => array(
          'token_rules_input_evaluator' => array(
            'uid_param' => array(
              0 => 'user1',
            ),
            'uid_target_param' => array(
              0 => 'user2',
            ),
            'variables_param' => array(
              0 => 'user1',
              1 => 'rtid',
              2 => 'user2',
            ),
          ),
        ),
      ),
    )),
  );

  //dsm($config);
  return $config;
}

Functions

Namesort descending Description
friendlist_activity_default Function to work with rules defined in friendlist
friendlist_activity_rules_defaults @file Rules' pre-configured rules.