Why isn't code for $op == 'presave' being executed in hook_nodeapi? I want the administrator users can publish nodes of the story content type; the other roles can unpublish. The following is the code I am using, but it doesn't work. I unchecked the box "published", which is in the "story" content type.

   function mymodulename_nodeapi(&amp;$node, $op, $a3 = NULL, $a4 = NULL) { 
     global $user; 

     if ($op== 'presave' &amp;&amp; $node-&gt;type == 'story') { 
       if (in_array('administrator',array_values($user-&gt;roles))) { 
         $node-&gt;status = 1;
       }
     }
   } 


I am using echo 'test' above on the if ($op....), the page outputs "test." When I put the echo 'test' into if body, the page doesn't output "test." but When I delete $op == 'presave'， it can output "test."
Regarding your problem, you're editing the node right ? Because presave acts during saving.

On a site I use this module which is quite handy, maybe it can help you: Publish Content