Forum Replies Created
- AuthorPosts
lawrencepepper
ParticipantOK,
I have it working but not sure why this happens.
In the form settings if I change the mail type to global instead of PHP (mail) it works.
My global default is PHP mail.
So there you go…
L
lawrencepepper
ParticipantHello Ally,
I tried your suggestion but it still does not work.
If I remove the code and use the static email field set in the form settings the email sends. As soon as I place the code listed above with your suggestion in the functions page it no longer works.
Code I am using:
function mytheme_modify_recipients($mailer, $form, $attachments)
{if (is_user_logged_in()) {
global $current_user;
get_currentuserinfo();
$person = $current_user->user_login;
}$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("time", $con);
$result = mysql_query("SELECT * FROM employee WHERE user_name = '$person'");
while($row = mysql_fetch_array($result))
$mailer->AddAddress($row['supervisor_email']);
return $mailer;
}
add_filter('iphorm_pre_send_notification_email_5', 'mytheme_modify_recipients', 10, 3);lawrencepepper
ParticipantAlso,
I would like to set the “From ” address as well, how can I incorporate that into the code above as well?
L
lawrencepepper
ParticipantOK,
Figured out the error, I needed a ; at the end of the last line. Oops!
BUT,
The form is not emailing anything now. When submitted it says the form has been sent but nothing shows in email.
Is $mailer the proper field? I want the recipient of this form to be the ‘supervisor_email’ that I am getting form the query.
L
- This reply was modified 11 years, 5 months ago by
lawrencepepper.
lawrencepepper
ParticipantTried this:
#Set Approval Emailfunction mytheme_modify_recipients($mailer, $form, $attachments)
{if (is_user_logged_in()) {
global $current_user;
get_currentuserinfo();
$person = $current_user->user_login;
}$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("time", $con);
$result = mysql_query("SELECT * FROM employee WHERE user_name = '$person'");
while($row = mysql_fetch_array($result))
$mailer = $row['supervisor_email'];
return $mailer;
}
add_filter('iphorm_pre_send_notification_email_7', 'mytheme_modify_recipients', 10, 3)Still getting errors.
L
lawrencepepper
ParticipantSee below….
- This reply was modified 11 years, 5 months ago by
lawrencepepper.
lawrencepepper
ParticipantFigured this out.
Just use [raw][/raw] tags around the insertion code.
Fixed.
L
lawrencepepper
ParticipantWhat I would like to do is have a hidden form field on the form with an email address in it. This email would be the address that the form data goes to.
This way I could dynamically populate the hidden field with whatever email address I need.
L
lawrencepepper
ParticipantI am having the same sort of problem with another form.
I need the recipient of the email being generated to be a dynamic variable.
How can this be done.
L
lawrencepepper
ParticipantGot it all working.
Thanks!
L
lawrencepepper
ParticipantOops!
I see….
did not change all values in the second $end line…
L
lawrencepepper
ParticipantSomething is now working right:
The second date being passed keeps coming up:
2013-2-02
No matter what I pick in the date picker on the form page.
The first always comes correct.
My code is:
$start = $_SESSION['iphorm_4']['iphorm_4_1'];
$start = $start['year'] . '-' . $start['month'] . '-' . $start['day'];$end = $_SESSION['iphorm_4']['iphorm_4_2'];
$end = $end['year'] . '-' . $start['month'] . '-' . $start['day'];
The start date always passes correctly but the end date keeps coming up 2013-02-12 no matter what I pick in the date picker on the form page.
my code in the functions.php file is:
function submit_range($form)
{
$_SESSION['iphorm_4'] = $form->getValues();
}
add_action('iphorm_post_process_4', 'submit_range');
lawrencepepper
ParticipantThanks Ally!
How can I have the day default to have a 0 in front of it is it is 9 or below:
2013-11-04
right now it is coming out
2013-11-4
L
lawrencepepper
ParticipantPlease forgive me but my PHP is not all that great, could you give me some direction on how to do that or point me to an example on the web?
Just searched stack overflow but nothing really comes up for my example….
Thanks
L
lawrencepepper
ParticipantWell,
I found another way but still stuck.
I am using the following code to set session variables:
function submit_range($form)
{
$_SESSION['iphorm_4'] = $form->getValues();
}
add_action('iphorm_post_process_4', 'submit_range');I am passing a start date and an end date.
Then on the redirected page I am trying to run a query selecting data from my database between a date range using those two dates passed by the form.
On the reirected page I am setting the variables passed as so:
$start = $_SESSION[‘iphorm_4’][‘iphorm_4_1’];
$end = $_SESSION[‘iphorm_4’][‘iphorm_4_2’];Then running a query using them as so:
WHERE date BETWEEN ‘$start’ AND ‘$end’
But this does not work.
Any help?
L
- This reply was modified 11 years, 5 months ago by
- AuthorPosts