How can you send the form results to the logged-in user's email address?
Forums
Send results to logged in user?
Hi bullfn33,
You can access all of the logged in users info using the $my Object. The code is slightly different in the Joomla versions. In either case create a dummy field in your form:
Bob
PS From memory, not tested, may be buggy!
You can access all of the logged in users info using the $my Object. The code is slightly different in the Joomla versions. In either case create a dummy field in your form:
<input type="hidden" name="user_email" value="" />
Then, in the Onsubmit before box, for 1.0.x use:<?php
global $my;
$_POST['user_email'] = $my->email;
?>
or for Joomla 1.5.x use:<?php
$user = & JFactory::getUser();
$_POST['user_email'] = $user->email;
?>
Then you can use the {user_email} field as you would any other.
Bob
PS From memory, not tested, may be buggy!
OK, I got it to send the results to the user's email. However, I had previously had the Profile Page plugin set up to pull the username from another hidden field and include it in the saved data but now it is not saving the username there.
Is adding in the code to pull the user's email somehow interfering with the Profile Page plugin set up for the username pull? Thanks
Is adding in the code to pull the user's email somehow interfering with the Profile Page plugin set up for the username pull? Thanks
Hi Bullfn33,
I don't have the slightest idea - I'm not even sure that I understand the question fully. Can you post the Form backup and instructions on how to set it up with the plugin so that i can try it out.
Why are you using the plugin to pull the username - that's available from the $my or $user Object?
Bob
I don't have the slightest idea - I'm not even sure that I understand the question fully. Can you post the Form backup and instructions on how to set it up with the plugin so that i can try it out.
Why are you using the plugin to pull the username - that's available from the $my or $user Object?
Bob
Never mind, I got it to work using the Onsubmit code.🙂
When I first started playing around with CF, I had it pulling the username from the profile plugin because when I read the tooltip in the plugins tab, I thought it sounded like what I needed and it had worked. I wasn't too keen on some of the other functions at the time.
Thanks again!
Why are you using the plugin to pull the username - that's available from the $my or $user Object?
When I first started playing around with CF, I had it pulling the username from the profile plugin because when I read the tooltip in the plugins tab, I thought it sounded like what I needed and it had worked. I wasn't too keen on some of the other functions at the time.
Thanks again!
This topic is locked and no more replies can be posted.