Dynamic_To based on &var URL

scirrito 04 Nov, 2011
We setup $users for Loan Officers only in joomla. No self-registration is allowed so all users are set by our company. I have a form that captures & stores data and includes an added string with the VAR &owner={owner}.
(index.php?option=com_chronocontact&chronoformname=connectionform&owner=mfeely)

The {owner} field in our chronoform_db (with ChronoConnectivity) is linked to $username of jos_users so the WHERE clause will show only records when the user logs-in.
<?php
$user =& JFactory::getUser();
echo "WHERE `owner` = '{$user->username}' ";
?>


What I need help with:- We need to be able to look at the {owner} var which always equals {username} and call the (username,email} from jos_user and set the 'dynamic_to' for the message in the connectionform. This will be dynamic based on each form VAR{owner} that has just been submitted.

- if the form var is &owner=jsmith, then we need an alert message to go to $username (jsmith).
- At no time is a user ever logged in when the form is submitted.

Hope I explained this correctly.
GreyHead 05 Nov, 2011
Hi scirrito,

You can use the usernamein getUser() to get the info for a particular user. Then put the info you need into the form data and you can use it in a Dynamic Email box.
<?php
$owner = JRequest::getString('owner', '', 'post');
$owner_info =& JFactory::getUser($owner);
JRequest::setVar('owner-email', $owner_info->email);
?>


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