0

I'm trying to make a small modification in the body a node when it's saved:

function radicalislam_utils_nodeapi(&$node, $op) {
      if ($op == 'presave') 
             $node->body = 'test';
}

but what I'm getting is strange. when I view the node, i really see only "test" as the body. but when i go edit the post, i see all that previously on the body and "test" appended in the end...

Why is that?

2

If the body of a node differs from its teaser, it will show both when editing (it'll append the real body to the teaser, which is why it looks like you're still seeing the old version of the body).

In other words: make sure your body and your teaser are both altered before saving.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.