Public User Cannot Save New Records

debbieae

New member
DaDaBIK version 11.10
PHP Version: 8.1.18
mysql version: 5.7.43

I have a public user set up. The only permissions this user has is an initial custom page and the ability to add new records to one table. This has been working well, but yesterday we discovered that the new records were not saving when we attempt to create them with this public user. We do not get any errors or messages, the record simply does not exist. I have tried adding more permissions to the public user to see if it was strictly a permission issue, but that has not worked. I have also tried adding records to this table as a different user and it has worked with both admin privileges and a standard user's privileges.

I did have an operational hook to take the user back to the custom Page splash screen after insert. I have removed that on the chance that this might be interfering with the save.

Any ideas as to what to try next to get this working?

Thanks,
Debbie
 

eugenio

Administrator
Staff member
Hello,
the public user should be able to do anything you set the permissions for, so if you have set, for the corresponding group, CREATE permissions to YES, it should work. I am not aware of any related issues.
You said you have an operational hook and you tried to remove it but it's not clear if, after removing it, the issue disappeared.

Best,
 

debbieae

New member
I removed the operational hook, but still get no ability to add records.
I have increased the permission level, still no records added.

I am very frustrated, because this was working perfectly in the past. I think that some error must be occurring and I am just not getting any messages that it is happening.
 

debbieae

New member
I have tried creating a new form from a view on the same table. That one is able to add records. The only thing that changed is that I added buttons to the edit form. Commenting these out has not reverted insert to its previous functionality, so I will just use the redundant insert for now.
 

debbieae

New member
The new form has confirmed it. The after insert code is preventing the record from saving. Not sure why removing it did not restore the original table's ability to save. Here is the code:

$hooks['vwClientEntry']['insert']['after'] = 'dadabik_disclaimer_page';

Function dadabik_disclaimer_page(){

header('Location:'.$dadabik_main_file.'?function=show_static_page&id_static_page=18');
exit;
}
 

eugenio

Administrator
Staff member
The exit prevents the last part of the DaDaBIK code (including the commit of the transaction) to be executed, that's why the insert doesn't work.
It may work if you remove the exit and leave the header but don't rely on it, at some point you can get unexpected behaviours.
 
Top