cuny-academic-commons / bp-event-organiser

Allows Event Organiser plugin events to be assigned to BuddyPress groups and generates a group calendar page for each group
GNU General Public License v2.0
3 stars 1 forks source link

ical file should be sent as attachment on BPGES immediate notification #66

Open boonebgorges opened 5 years ago

boonebgorges commented 5 years ago

I think we currently provide a link to download the .ics file, but it would be better (mail client would recognize) if we actually attached the .ics file. This is a request from the folks at MLA, and I can work on it for them in a couple weeks, but it's a good enhancement for the plugin more generally.

ccing @r-a-y just as an fyi :)

nalonsopress commented 5 years ago

Moving this here in case there's confusion: PHP Warning: file_get_contents(BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Humanities Commons//NONSGML Events//EN CALSCALE:GREGORIAN X-ORIGINAL-URL:https://...@127.0.0.1 STATUS:CONFIRMED DTSTAMP:20190424T144028Z CREATED:20190424T184027Z LAST-MODIFIED:20190424T184027Z DTSTART;TZID=America/New_York:20190424T150000 DTEND;TZID=America/New_York:20190424T160000 SUMMARY: asdfasdfasdf DESCRIPTION: asdfasdfasdf X-ALT-DESC;FMTTYPE=text/html: <p>asdfasdfasdf</p> ORGANIZER;CN="Jennifer Jones":MAILTO:jennifer@signhcommons.org URL;VALUE=URI:https://hcommons-dev.org/events/event/asdfasdfasdf/ END:VEVENT BEGIN:VTIMEZONE TZID:America/New_York BEGIN:STANDARD TZOFFSETFROM:-0400 TZOFFSETTO:-0500 DTSTART:20181104T060000 TZNAME:EST END:STANDARD BEGIN:DAYLIGHT TZOFFSETFROM:-0500 TZOFFSETTO:-0400 DTSTART:20190310T070000 TZNAME:EDT END:DAYLIGHT END:VTIMEZONE END:VCALENDAR ): failed to open stream: No such file or directory in /srv/www/commons/current/web/app/plugins/sparkpost/mailer.http.class.php on line 175

r-a-y commented 5 years ago

@nalonsopress - I mentioned in the other thread that your bug appears to be caused by your usage of the SparkPost WP plugin. Maybe they did not implement all of PHPMailer's properties.

nalonsopress commented 5 years ago

It's a file_get_contents issue, it's expecting a path, but @boonebgorges passed it a variable. Sparkpost corrected this it looks like , we just need to upgrade. When I implemented this patch, it works fine.

protected function read_attachment($data)
   {
        // If the provided String is a File Path, load the File Contents. If not, assume the String is the contents
        // This allows PHPMailer's addStringAttachment() method to work thereby avoiding the need to store a file on the server before attaching it
        if ( is_file( $data ) ) {

            return file_get_contents($data);
        }
        else {
            return $data;
        }

Thanks again guys.

boonebgorges commented 5 years ago

Ah, interesting. I intentionally used PHPMailer's addStringAttachment() so that I didn't have to store a file :) If this is just a problem with SparkPost's integration, then I think I'll leave as-is.