function heartbeat_api_log in Heartbeat 6.4
Same name and namespace in other branches
- 6.3 heartbeat.module \heartbeat_api_log()
- 7 heartbeat.module \heartbeat_api_log()
API function to log a message from custom code
Parameters
string $message_id: Id of the message that is known in the message
integer $uid: Actor or user performing the activity
integer $uid_target [optional]: user id of the target user if present. Target users can be an addresse or a user relation transaction with the actor $uid
integer $nid [optional]: Node id for content (for context node)
integer $nid_target [optional]: Node id for content that is related to other content
array $variables [optional]: Variables can be used if you used them in the used message. Take care to use the @-sign for words that are prefix with the question mark sign in the messages you can even set and use custom variables. They shouldn't conflict with the required ones. Note: variables['time'] is a special one you can use to alter the message time at log time.
integer $access: The access to restrict the message
4 calls to heartbeat_api_log()
- heartbeattest_nodeapi in tests/
heartbeattest.module - Implementation of hook_nodeapi().
- heartbeat_example_nodeapi in modules/
heartbeat_example/ heartbeat_example.module - Implementation of hook_nodeapi().
- heartbeat_rules_default_action in 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
- heartbeat_rules_users_action in modules/
heartbeat_rules/ hrules.rules.inc - Action Implementation: Log an activity between two users.
File
- ./
heartbeat.module, line 1108
Code
function heartbeat_api_log($message_id, $uid, $uid_target = 0, $nid = 0, $nid_target = 0, $variables = NULL, $access = HEARTBEAT_PUBLIC_TO_ALL) {
$data = array();
// Normal form values
$data['message_id'] = $message_id;
$data['uid'] = $uid;
$data['uid_target'] = $uid_target;
$data['nid'] = $nid;
$data['nid_target'] = $nid_target;
$data['access'] = $access;
if (!empty($variables)) {
if (is_array($variables)) {
if (isset($variables['time'])) {
$data['timestamp'] = $variables['time'];
unset($variables['time']);
}
$data['variables'] = heartbeat_encode_message_variables($variables);
}
if (is_string($variables)) {
$data['variables'] = $variables;
}
}
return heartbeat_log($data);
}