Skip to main content
added 2 characters in body
Source Link
samuelsov
  • 2.3k
  • 15
  • 34

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.

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.

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.

Source Link
samuelsov
  • 2.3k
  • 15
  • 34

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.