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, //...
by javier | Nov 13, 2020 | Table Hook Modifications
In this example, let’s assume that our table contains the fields: unit_price, quantity and total. We want to automatically calculate the value of the total field by multiplying quantity and unit_price. Open the tablename.php on your hooks folder. function...
by javier | Nov 13, 2020 | Table Hook Modifications
The following example checks that the logged user belongs to the admin group and accordingly allows CSV downloading of records. If the user is not a member of the admin group, CSV downloads are disabled. On the hooks folder look for the tablename.php function...
Recent Comments