Let’s say that we want to prevent updates to any records in a particular table that are older than 30 days. To do so, we would customize the tablename_before_update() hooks like this:
function
tablename_before_update(&
$data
,
$memberInfo
, &
$args
){
// get the creation date of the record
$creationDate
=sqlValue("select dateAdded from membership_userrecords
where tableName=
'tablename'
and
pkValue=
'{$data['
selectedID
']}'
");
// if the record is older than 30 days, deny changes
if
(
$creationDate
<
strtotime
(
'30 days ago'
))
return
false;
return
true;
}