You are here

function heartbeattest_nodeapi in Heartbeat 6.4

Implementation of hook_nodeapi().

File

tests/heartbeattest.module, line 14
Test module to use within simpletest.

Code

function heartbeattest_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {

  // The test module will log activity to heartbeat when
  // a page is added or edited. You can see this as an example
  // though this module cannot be enabled in production sites.
  if ($op == 'insert' && $node->type == 'page') {
    $variables = array(
      '@username' => $node->uid ? l(!empty($node->name) ? $node->name : heartbeat_user_load($node->uid)->name, 'user/' . $node->uid) : variable_get('anonymous', t('Anonymous')),
      '@node_type' => 'page',
      '@node_title' => l($node->title, 'node/' . $node->nid),
    );
    heartbeat_api_log('heartbeattest_add_node', $node->uid, 0, $node->nid, 0, $variables);
  }
}