vipzeus
Member
I have a form "userdetails" where registered user can add the billing informations.
This form has juser plugin and php code on before form load.
With this code i insert the userid correctly but user informations as email, password, loading after page refresh.
That just for the first time. Next times load correctly as userid existing.
My question is:
The trigger onBeforeLoad must create first the userid and then load all data email, password, username ecc (thanks juser plugin) ?
If not, how i can resolve this problem?
This form has juser plugin and php code on before form load.
PHP:
$user = JFactory::getUser();
$db = JFactory::getDbo();
$userid = $user->get('id');
$db->setQuery("SELECT * FROM userdetails WHERE userid = '$userid'");
$row = $db->loadResult();
if (empty($row)) {
$db->setQuery("INSERT INTO userdetails (userid) VALUES ($userid)");
$db->query();
}
That just for the first time. Next times load correctly as userid existing.
My question is:
The trigger onBeforeLoad must create first the userid and then load all data email, password, username ecc (thanks juser plugin) ?
If not, how i can resolve this problem?