3

On Drupal 7.35 / Civi 4.4.14 - is it possible for a membership payment via CiviContribute to e-mail a membership certificate as a PDF as an attachment to a receipt?

What we currently do is print membership certificates and post them, however the intention is to move to e-mailing them. I already have the template certificate stored as a mailing message template which comes out nicely when printed on A4.

3 Answers 3

4

I don't think it's possible right now without coding.

If you are not afraid of coding, what you could do is something like :

  1. add you membership certificate after the content of the receipt (in templates) and add an arbitrary separator between your receipt and the certificate. In my case <!--break-->.

  2. use the hook_civicrm_alterMailParams with the following content (extract the part after <!--break--> and put it in a pdf as a attachment) :

    $pos = strpos($params['html'], '<!--break-->');
    if ($pos !== False) {
      $pdf_content = substr($params['html'], $pos + 12);
      $params['html'] = substr($params['html'], 0, $pos);
    
      if (empty($params['attachments'])) {
        $params['attachments'] = array();
      }
      $params['attachments'][] = CRM_Utils_Mail::appendPDF(ts('Membership certificate') . '.pdf', $pdf_content);
    }
    

I may create a little extension for this.

1
  • I might have to think of a different way around it then, I was contemplating issuing the receipt and then on a daily basis running a command to find all the new renewals and send them an e-mail with the certificate as an e-mail for them to print. It does not sound like it will work, but I will have a look because the certificate template is a single image, and then the membership details tokens overlaying it..... Commented Mar 31, 2015 at 17:27
1

This would be two steps as far as emailing it, but you could build the certificate as a "PDF Letter" template. You might need to do some HTML and tokens, but no other coding.

Every day, week, or month (whatever your schedule), you can search for new members (Memberships > Find Memberships). From the results, pick the first, and in the Actions drop-down, select "Print PDF letters for memberships". You can pick the certificate template you made (or you can create it on the spot with the first member), and it'll generate a PDF. Save the PDF and attach it to an email to the member. You can then repeat it member-by-member.

It would be great to have an easy thing like Samuel describes, because that would be one step instead of two, but this would work in a pinch.

0

If you do the work to produce an email with the certificate as an attachment then you can use a scheduled reminder to send the email a day or so after the member signs up or renews.

3
  • Hi Joe, I did think of using scheduled reminders and using the message template of a full membership certificate as the body of the e-mail. If a member renews, will the renewal date be seen as the membership start date though as we try to renew these on an annual basis. Commented Apr 3, 2015 at 7:34
  • The start date for renewed membership is the day after the previous membership's end date. This is true both for fixed date membership types eg calendar year for eveyone, and for rolling period membership types, where the annual membership period starts whenever a person joins. This assumes it is a renewal done before end of membership or in grace period. If membership has expired then start date will be set the same as for a new membership.
    – Joe Murray
    Commented Apr 3, 2015 at 22:50
  • Hi Joe. Thanks for your assistance with this. As we have a fixed period 1 April to 31 March, so I understand that if a membership is renewed before 31 March it will trigger on 1st April for "Join Date +1 Day" and if it was renewed on the 10th April it would trigger on the 11th. Now (and sorry I am asking way too many questions) if an individual renews for an organisation, where does the certificate go? To the individuals e-mail or the organisations. Commented Apr 3, 2015 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.