R – Drupal: How to get a CCK field value when inserting a node

cckdrupal

I'm working on a registration system where someone can enter the number of participants they will be bringing in a CCK field. I want to, whenever a node type with that CCK field is added, grab the value of that field, then add it to a variable value I have in my variables table.

Is the CCK value inserted into the field's table in the db prior to my custom module running something when $op is "insert" for hook_nodeapi? Or is there some other way to directly grab the value of that field?

Best Answer

Here's how I solved this: I used the Rules module, and set up a ruleset to update the number of reserved registration spots by SUM-ing the CCK field containing each group's number reserved. Then I created rules for node additions, updates, and deletions, so the number auto-updates at all times.

It was much easier than using hook_nodeapi, and will be much easier to maintain...

Related Topic