Reproduction.
-Create a CCK node called domain
-Create a new module - mymodule
-Create the hook-nodeapi as follows
function mymodule_nodeapi(&$node, $op, $teaser = NULL, $page = NULL)
{
if ($node->type == 'domain')
{
switch ($op)
{
case 'insert':
case 'update':
$domain = preg_replace("/^http:\/\//i", "", trim($node->title));
$node->title = preg_replace("/^www./i", "", $domain);
break;
}
}
}

Edit the node and enter http://www.abc.com as the title and save the node.
The message shows that abc.com has been saved however http://www.abc.com is actually saved.

I havde assumed that the node changes are meant to be allowed since the node is passed in by reference otherwise it would seem senseless to pass the node in that way.

Thanks,
KT

Comments

yched’s picture

Project: Content Construction Kit (CCK) » Drupal core
Version: 6.x-2.1 » 6.x-dev
Component: General » node system
Category: bug » support

CCK does not handle this. Note that there are no such things as 'CCK nodes'. CCK is only responsible for fields it 'adds' to nodes, not for nodes themselves

damien tournoud’s picture

Status: Active » Closed (works as designed)

And there is a marvelous documentation for hook_nodeapi(): you can't modify the content of the node during insert and update operations. You are perhaps looking for the 'presave' operation, or, better yet, adding a '#validate' handler to the node form.

ktalai’s picture

Thank you very much for the guidance