Hello,
I'm not sure if I m allowed to post it here, but I would like an answer, and I m not sure "drupal answer" could help me...
So...
I'm trying to send meeting request to user after they submit a webform.
In this webform, they can fill in a start date and stop date (for exemple).
And I would like to get the value of start date in the webform to use it in my meeting request.
I can send this meeting request with the code below:
function sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location)
{
$domain = 'domain.tld';
//Create Email Headers
$mime_boundary = "----Meeting Booking----".MD5(TIME());
$headers = "From: ".$from_name." <".$from_address.">\n";
$headers .= "Reply-To: ".$from_name." <".$from_address.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
$headers .= "Content-class: urn:content-classes:calendarmessage\n";
//Create Email Body (HTML)
$message = "--$mime_boundary\r\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= "<html>\n";
$message .= "<body>\n";
$message .= '<p>'.$description.'</p>';
$message .= "</body>\n";
$message .= "</html>\n";
$message .= "--$mime_boundary\r\n";
$ical = 'BEGIN:VCALENDAR' . "\r\n" .
'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "\r\n" .
'VERSION:2.0' . "\r\n" .
'METHOD:REQUEST' . "\r\n" .
'BEGIN:VTIMEZONE' . "\r\n" .
'TZID:Romance Standard Time' . "\r\n" .
'BEGIN:STANDARD' . "\r\n" .
'DTSTART:16011028T030000' . "\r\n" .
'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11' . "\r\n" .
'TZOFFSETFROM:+0200' . "\r\n" .
'TZOFFSETTO:+0100' . "\r\n" .
'TZNAME:Romance Standard Time' . "\r\n" .
'END:STANDARD' . "\r\n" .
'BEGIN:DAYLIGHT' . "\r\n" .
'DTSTART:16010325T020000' . "\r\n" .
'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3' . "\r\n" .
'TZOFFSETFROM:+0200' . "\r\n" .
'TZOFFSETTO:+0100' . "\r\n" .
'TZNAME:EDST' . "\r\n" .
'END:DAYLIGHT' . "\r\n" .
'END:VTIMEZONE' . "\r\n" .
'BEGIN:VEVENT' . "\r\n" .
'ORGANIZER;CN="'.$from_name.'":MAILTO:'.$from_address. "\r\n" .
'ATTENDEE;CN="'.$to_name.'";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:'.$to_address. "\r\n" .
'LAST-MODIFIED:' . date("Ymd\TGis") . "\r\n" .
'UID:'.date("Ymd\TGis", strtotime($startTime)).rand()."@".$domain."\r\n" .
'DTSTAMP:'.date("Ymd\TGis"). "\r\n" .
'DTSTART;TZID="Romance Standard Time":'.date("Ymd\THis", strtotime($startTime)). "\r\n" .
'DTEND;TZID="Romance Standard Time":'.date("Ymd\THis", strtotime($endTime)). "\r\n" .
'TRANSP:OPAQUE'. "\r\n" .
'SEQUENCE:1'. "\r\n" .
'SUMMARY:' . $subject . "\r\n" .
'LOCATION:' . $location . "\r\n" .
'CLASS:PUBLIC'. "\r\n" .
'PRIORITY:5'. "\r\n" .
'BEGIN:VALARM' . "\r\n" .
'TRIGGER:-PT15M' . "\r\n" .
'ACTION:DISPLAY' . "\r\n" .
'DESCRIPTION:Reminder' . "\r\n" .
'END:VALARM' . "\r\n" .
'END:VEVENT'. "\r\n" .
'END:VCALENDAR'. "\r\n";
$message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST'."\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= $ical;
$mailsent = mail($to_address, $subject, $message, $headers);
return ($mailsent)?(true):(false);
}
$from_name = "webmaster";
$from_address = "webmaster@domain.tld";
$to_name = "Name";
$to_address = "user@domain.tld";
$startTime = $date;
$endTime = "07/01/2015 02:00";
$subject = "Test Subject";
$description = "description";
$location = "FlowLine";
sendIcalEvent($from_name, $from_address, $to_name, $to_address,$startTime,$endTime, $subject, $description, $location);So I use this code in my confirmation page.
BUT I would like that startime = [submission:values:date]... (date is a webform field name)
How can I make it possible? Maybe using the confirmation page is not the wright way...
I am not a developer, I would like to modify the webform code the less I can.
Regards,
Comments
Comment #1
danchadwick commentedFirst, update to the latest stable. 4.2 has a security vulnerability.
Second, Drupal Answers would probably give you a more detailed answer. We don't provide custom programming support in the webform issue queue, as described in the big "STOP" notice before you posted.
Third, I would use a regular webform confirmation email to construct a custom URL containing the start date and end date as URL query, e.g. http://www.example.com/node/123?start_date=[submission:values:my_start_d....
Then write a small custom module and implement hook_webform_client_form_123_alter() and set the default values for the start and end date.
If this doesn't make sense to you, I suggest you hire a developer to help you.
Comment #2
fumble commentedFirst of all, thank you for your answer, despite the fact that I am not suppose to post that here...
I knew that I was not in the right place, but every answers I got to my past issues was here... So I tried my luck, really sorry about that!
Anyway, I do not have updated yet because this website is not accessible for the outside... so, has long has it's working, I m not updating :) But I will, I promise ;)
Your solution totaly make sense! (at least part of it, I need to document myself a little bit more on this "hook_webform_client_form" story :) but at least, it is a step ahead)
Once again thank you, and once again, sorry for this post, I m going to move it to Drupal Answer.
Bye guys,
Comment #3
danchadwick commentedI suggest you read the release notes for 4.3 through 4.9 and decide how urgently you should update. 4.2 has dozens of bugs that have since been fixed. Your choice, of course.