Forums

Chronoforms, DB load and email actions

edouardlemen 23 Apr, 2015
Hi,

I was wondering if there is a possibility to create a simple form with an email input for instance, that would be able on load or on submit to launch a database read action to find the registered user in Joomla user table that correspond to the email input and then, add an email action that will send to the user selected informations taken from the joomla registration table.

Thank you.

Best,

Edouard
GreyHead 23 Apr, 2015
Hi Edouard,

Yes that is possible. I'd probably use a Custom Code action to get the User ID from the email like this:
<?php
$db = \JFactory::getDBO();
$query = "
    SELECT `id`
        FROM `#__users`
        WHERE `email` = '{$form->data['email']}' ;
";
$db->setQuery($query);
$user_id = $db->loadResult();
$user = \JFactory::getUser($user_id);
?>
That should put the User Object in $user so that you can continue using the data as needed by adding the email and any other values you want to send to the $form->data[] array.

Bob
This topic is locked and no more replies can be posted.