You are here

function og_node_view in Organic groups 5.7

Same name and namespace in other branches
  1. 5.8 og.module \og_node_view()
  2. 5 og.module \og_node_view()
  3. 5.2 og.module \og_node_view()
  4. 5.3 og.module \og_node_view()

Similar to node_view() but without calling theme('node').

This is needed to get the proper body or teaser for nodes (e.g. Event, Location, CCK node types) and to clean up the body for use in email notifications.

Parameters

$node: The node object you want to view.

$teaser: Boolean to select the teaser or the body of the node.

Return value

The requested data, filtered and ready for use in an e-mail.

See also

node_view()

og_mail()

1 call to og_node_view()
og_mail in ./og.module
Send this node/comment via email to all email members. Called from og_nodeapi() and og_comment(). Sometimes called from during cron if job_queue.module is enabled (recommended). TODO: this function is a bit messy. rethink.

File

./og.module, line 2027

Code

function og_node_view($node, $teaser = FALSE) {

  // Remove the delimiter (if any) that separates the teaser from the body.
  // TODO: this strips legitimate uses of '<!--break-->' also.
  $node->body = str_replace('<!--break-->', '', $node->body);

  // The 'view' hook can be implemented to overwrite the default function
  // to display nodes.
  if (node_hook($node, 'view')) {
    node_invoke($node, 'view', $teaser, TRUE);
  }
  else {
    $node = node_prepare($node, $teaser);
  }

  // Allow modules to change $node->body before viewing.
  node_invoke_nodeapi($node, 'view', $teaser, TRUE);
  return $teaser ? $node->teaser : $node->body;
}