I’m updating a node with nodeapi update, but there’s more that I need to do behind the scenes which requires me to know the old value of a field/ Is there a way I could get the old value of a field before it’s overwritten.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Edit
hook_nodeapi()only acts on the new$nodeobject, so my earlier answer won’t help you. Instead, you’ll need to access the node as it gets submitted. To do that, you’ll need to register your own submit handler that’ll get called when the node form is submitted. It’ll give you access to both the current values and the new values:updateis called the$nodeobject has been updated. You might be more interested inpresave, which checks the node after validation, orvalidate, which checks it before validation; both$ops fire before the new$nodeobject is saved.