The problem is that the table already contains records and therefore the code must also be applied to records already created as the records are updated.
I thought that the problem could be solved by inserting this code in the hook file, in the "after update" function but this is not good because if the administrator changes the contents of the record the fields are updated with the administrator data while I need the "uer_name" and "user" fields kept the owner's data.
.. so this code doesn't work for my purpose:
Code: Select all
function my_table_after_insert($data, $memberInfo, &$args) {
$mi = getMemberInfo();
$data['user'] = $mi['custom'][0];
$mi = getMemberInfo();
$data['user_name'] = $mi['username'][0];
return TRUE;
Fabiano