Forums

problem: empty form in frontend although db save / db read

hcohl 06 Jun, 2017
I builded a form with db save and db read. A logged in user can fill the form - and on a later login find his data in the form again.
My problem now: sometimes (not allways) a user who logges in again finds an empty form and not his data. (The data are written correctly in the db (Connectes Tables), but during login he gets a new empty form with a new id under Connected Tables.)
The problem is, that in these cases the user_id in the Connected Table doesn't show the correct user_id - it shows "0". Why chronoforms doesn't take the correct user_id instead of "0".
This is my code under Conditions in Setup > db read:

<?php
$user = \JFactory::getUser();
if ( $user->id > 0 ) {
return array( 'user_id' => $user->id );
} else {
return array( ": 'AAA' = 'ZZZ' " );
}
?>
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger