[development] &$node in nodeapi

luca capra luca.capra at gmail.com
Mon Oct 4 15:54:08 UTC 2010


Oops... it's right.

Thank you
Luca

On 04/10/2010 17:14, Adam B. Ross wrote:
> Good morning Luca,
>
> 'insert' and 'update' ops are fired *after* the node has been saved to
> the database. To make changes to the node before it is saved, you
> should make adjustments in 'presave'.
>
> - Grayside
>
> On Mon, Oct 4, 2010 at 7:50 AM, luca capra<luca.capra at gmail.com>  wrote:
>    
>> Good evening,
>>
>> I'm writing a custom module, with a call to hook_nodeapi (on php 5.3, latest
>> drupal 6)
>> I update some cck fields, but looking at the saved node page, these fields
>> are empty.
>>
>> Seems that after the hook, cck fields lose their values.
>>
>> function mymod_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL){
>>     switch($op){
>>        case "insert":
>>        case "update":
>>
>>             my_fill_cck(&$node );
>>
>>             // here cck are populated
>>             // krumo( $node );
>>         break;
>>         case "load":
>>             // viewing node, cck are empty :(
>>             // krumo( $node );
>>             return array();
>>         break;
>>     }
>> }
>>
>> Any idea is really appreciated.
>> Thank in advance.
>>
>> Best regards,
>> Luca
>>
>>      
>    


More information about the development mailing list