[development] easy way to check if a value has changed (nodeapi)

Henrique Recidive recidive at gmail.com
Sat Aug 22 17:36:35 UTC 2009


2009/8/22 Hans Langouche <hans.langouche at gmail.com>:
> Hi there,
>
> I'm working on a (node) profile system that has a checkbox to allow people
> to be informed by postal mail.  If checked the system sends a mail with the
> details to a certain email address.  Of course this email shouldn't be sent
> every time  the profile is updated, but only when the checkbox was
> previously unchecked (if it was checked allready, nothing should happen).
>
> For the moment I'm thinking of creating a second (hidden) value to which I
> compare on 'update' and sync with the actual value after the check.  But I'm
> thinking there must be an easier way, but can't find it in documentation or
> by inspecting $node on 'update'.

Wouldn't it suffice adding a table (uid, sent) so when user checked
the checkbox it will check for a record in that table for the current
user, if not there, it will send system email and add a record to that
table?

That way, you know if the checkbox was checked previously and can
decide to display it defaulting to checked, or just hide the checkbox.

Henrique

> Tnx,
>
> HnLn
>
>


More information about the development mailing list