Send results to logged in user?

Post any questions you may have here

Send results to logged in user?

Postby Bullfn33 on Sat Jul 12, 2008 2:00 am

How can you send the form results to the logged-in user's email address?
Bullfn33
Junior Boarder
 
Posts: 39
Joined: Thu Jul 03, 2008 11:31 pm

Re:Send results to logged in user?

Postby GreyHead on Sat Jul 12, 2008 5:12 am

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:
Code: Select all
<input type="hidden" name="user_email" value="" />
Then, in the Onsubmit before box, for 1.0.x use:
Code: Select all
<?php
global $my;
$_POST['user_email'] = $my->email;
?>
or for Joomla 1.5.x use:
Code: Select all
<?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!
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3369
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Send results to logged in user?

Postby Bullfn33 on Sat Jul 12, 2008 8:10 pm

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
Bullfn33
Junior Boarder
 
Posts: 39
Joined: Thu Jul 03, 2008 11:31 pm

Re:Send results to logged in user?

Postby Bullfn33 on Fri Jul 18, 2008 6:10 pm

bump
Bullfn33
Junior Boarder
 
Posts: 39
Joined: Thu Jul 03, 2008 11:31 pm

Re:Send results to logged in user?

Postby GreyHead on Fri Jul 18, 2008 10:01 pm

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
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3369
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Send results to logged in user?

Postby Bullfn33 on Sat Jul 19, 2008 5:17 pm

Never mind, I got it to work using the Onsubmit code. :)

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!
Bullfn33
Junior Boarder
 
Posts: 39
Joined: Thu Jul 03, 2008 11:31 pm


Return to ChronoForms Questions & Answers

Who is online

Users browsing this forum: Google [Bot] and 6 guests