Email a member identified in a Form

kknuth

New Member
I have a form that allows a user to create a Task and assign it to a user. The form contains the userid of the person who gets assigned to the Task. The user who got assigned the work should get an email with the details. I just need the syntax for the email plugin to populate the "Email To" field with the email address of the user.
Can anyone help?
 
Thanks Felixkat but the problem is I don't have a field with the email address. I only have the ID of the user. So how do I get the related email address?
 
No answers to this? Do I need to join to the joomla users table to have access to the email address?
 
What element type are you using to assign the user who gets the task?

Typically you'd use a database join to #__users, which has the id as the value, and the email address as the label. In which case the {yourtable___userid} (or whatever your element is called) would have the email in it, and {yourtable___userid_raw} would be the ID.

If for whatever reason you only have the ID, you could use the "Email to (eval)" and do something like this:

PHP:
$user = JFactory::getUser((int)'{yourtable___userid}');
return $user->get('email');

-- hugh
 
Thanks Cheesegrits. I modified it slightly to get it to work.
$user = JFactory::getUser('{fab_tasks___assignedto}');

...where fab_tasks is my table and assignto is the name of the field holding the user id of the user who got the task.

MUCH APPRECIATED!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top