return email address in form Email plugin

keianrad

Member
I saved all the client's contact details in app_address_book. I need to return client's email address from app_address_book and client's adviser email from app_staffs to use them in form email plugin of other forms.
Each client has a unique client_id.

How can I return the emails?

Thank you for your help.
 
In the email form plugin you have 'Email to (eval)' where you can add php code to fetch the email adresses from your tables.
 
Assuming you have the client_id on the form you are sending from ...

Code:
$clientId = $formModel->formData['yourtable___client_id_raw'];
$clientId = is_array($clientId) ? $clientId[0] : $clientId;
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->select('email')->from('app_address_book')->where('client_id = ' . $myDb->quote($clientId));
$myDb->setQuery($myQuery);
return $myDb->loadResult();

The adviser email would be the same approach, different table / field names.

However, I suggest you get me to add this to the class I'm building for you.

I'm available tonight and this weekend.

-- hugh
 
I tried to reach you by Skype but it seems you are so busy.
Please add it to the class that you are building. I need to have two separate functions for client email and adviser email.

adviser email are in app_staffs

As you know there is an adviser id element in some forms but not all such as tasks records,
so if there is an 'adviser_id' element in form that is sending email it should find the adviser email based on that adviser id in app_staffs, if there is not 'adviser_id' element on form it should check the client's adviser id and find the adviser email based on that.

If it is not clear leave a note on Skype then I will explain it more.

Thanks.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top