Get Registered User's Email

Zeon 01 Oct, 2009
Hi,
I have a form that is only available to registered users of a site. The form allows them to upload a file which then needs to be emailed to the admin. I have spent quite a bit of time trying to figure out how to have the "from" address of the email automatically come from their email address? I have tried the method from the following page:

<?php
global $my;
?>
Name: <?php echo  $my->name; ?><br />
Email: <?php echo  $my->email; ?>


http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=5&t=11193

Name works fine but the problem is the email cloaking plugin that comes with joomla is causing the email address to be scrambled. I don't want to disable the plugin as there are likely to be many email addresses published on the site.

I'm not sure if I should be using the "profile page" plugin for this but I don't think this is what that plugin is for - the userid is not part of the URL.

Ideas?
GreyHead 02 Oct, 2009
Hi Zeon,

First off, I strongly suggest that you *don't* use 'Dynamic From Email' addresses, there is a fair chance that your emails will be marked as spam if the From Email domain does not match your site domain.

Use the 'Dynamic Reply To Email' field instead.

Second, avoid including emails in the form html; set them up in the OnSubmit before box instead. Use some code like
<?php
$user =& JFactory::getUser();
JRequest::setVar('email' $user->email);
?>
If you search here on 'GetUser' you will find many examples.

Bob

PS You could use the Profile plugin, though it's not a particularly good answer here - if there is no 'id' in the url it will use the user id.

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