by javier | Nov 13, 2020 | Table Hook Modifications
This example logs the date and time a record was deleted and who deleted it. function tablename_after_delete($selectedID, $memberInfo, &$args){ // log file $logFile=’deletes.log’; // attempt to open the log file for appending...
by javier | Nov 13, 2020 | Table Hook Modifications
In this example, we’ll assume that our table contains a checkbox field named approved. We want to allow deleting of the record only if that field is not checked (set to 0). If the field is checked (set to 1), it won’t be deleted unless the user is a member...
by javier | Nov 13, 2020 | Table Hook Modifications
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){ ...
by javier | Nov 13, 2020 | Table Hook Modifications
Let’s say we have an orders table. When a user makes changes to a record and saves them, we want to automatically calculate the value of the total field using the fields subtotal, discount and sales_tax, where discount and sales_tax are stored as percentages...
by javier | Nov 13, 2020 | Table Hook Modifications
The following example sends a notification email to an employee when a user submits a new record. The email contains the record data. function tablename_after_insert($data, $memberInfo, &$args){ // to compose a message containing the submitted data, //...
Recent Comments