Reputation: 4802
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?
Upvotes: 1
Views: 1834
Reputation: 4802
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...
Upvotes: 1
Reputation: 5128
yes, hook_nodeapi. But it's not good way to save users data to variables data (each new user add new row for variables). Just keep it in cck fields.
Upvotes: 0