You are here

function forward_nodeapi in Forward 6

Same name and namespace in other branches
  1. 5 forward.module \forward_nodeapi()

Generate nodeapi integration, foward signup

File

./forward.module, line 698

Code

function forward_nodeapi(&$node, $op, $teaser = 0) {
  if (variable_get('forward_form_type', 'link') == 'form' && !$node->in_preview && variable_get('forward_display_' . $node->type, '1') == 1 && (!$teaser || variable_get('forward_display_teasers', 0))) {
    switch ($op) {
      case 'view':
        if (user_access('access forward')) {
          $output = drupal_get_form('forward_form', 'node/' . $node->nid, $node->title, TRUE);
          $node->content['forward'] = array(
            '#value' => $output,
            '#weight' => 10,
          );
        }
        break;
    }
  }
  switch ($op) {
    case 'insert':
      db_query('INSERT INTO {forward_statistics} (nid, last_forward_timestamp, forward_count, clickthrough_count) VALUES (%d, 0, 0, 0)', $node->nid);
      break;
    case 'delete':
      db_query('DELETE FROM {forward_statistics} WHERE nid = %d', $node->nid);
      break;
  }
}