friendlist_activity.rules.inc in Heartbeat 6.2
File
user_activity/modules/friendlist_activity/friendlist_activity.rules.inc
View source
<?php
function friendlist_activity_rules_action_info() {
$info = user_activity_rules_action_info();
$info = array(
'friendlist_activity_rules_action' => array(
'label' => t('Logs relational friendlist activity'),
'eval input' => $info['user_activity_rules_default_action']['eval input'],
'help' => 'Create a relation between users by logging their activities',
'module' => 'friendlist activity',
),
);
return $info;
}
function friendlist_activity_rules_action_form($settings, &$form) {
user_activity_rules_default_action_form($settings, $form);
}
function friendlist_activity_rules_action_submit(&$settings, $form, $form_state) {
user_activity_rules_default_action_submit($settings, $form, $form_state);
}
function friendlist_activity_rules_action($settings, $form = array(), $event_info = array()) {
$data_requester = array();
$data_requester['uid'] = $settings['uid_param'];
$data_requester['uid_target'] = $settings['uid_target_param'];
$data_requester['message'] = t($settings['message_param']);
$data_requester['message_concat'] = t($settings['message_concat_param']);
$data_requester['variables'] = $settings['variables_param'];
$data_requester['event'] = $settings['event_param'];
$data_requester['hid'] = heartbeat_event_id($data_requester['event']);
$variables = heartbeat_decode_message_variables($data_requester['variables']);
$args = array(
'@username1' => $variables['username1'],
'@username2' => $variables['username2'],
'#relation_type' => t($variables['relation_type']),
);
user_activity_log($data_requester, $args);
$data_requestee = $data_requester;
$data_requestee['uid'] = $data_requester['uid_target'];
$data_requestee['uid_target'] = $data_requester['uid'];
$args = array(
'@username1' => $variables['username2'],
'@username2' => $variables['username1'],
'#relation_type' => t($variables['relation_type']),
);
user_activity_log($data_requestee, $args);
}