• Our customer uses Sensei Certificates to generate certificates after a student passed their course.

    After the student passed their course we have an automated email including their certificate that gets send to the student.

    This function has been working for a long time, but since we updated from php V7.0 to V8.0 this function seems te be broken but sadly enough, but we don’t get any error messages.

    As you can see from the code that I included below we use the same function that is used in the Sensei Certificates plugin in: sensei-certificates -> classes -> class-woothemes-sensei-pdf-certificate.php (Line 130).
    But when we run this function to generate our PDF nothing get’s created in the email function but the default PDF still get’s generated.
    even though both functions are identical and both get the same data passed through them.

    So the problem that we have basically is that we can’t get the the certificate to download to our server ($path).

    As we have checked all the values and there is limited documentation on Sensei Certificates i was hoping you could help me out with our problem.

    $fpdf = Woothemes_Sensei_Certificates_TFPDF::get_tfpdf_object($orientation, ‘pt’, array( $image_attr[0], $image_attr[1] )
    );

    $fpdf->AddPage();
    $fpdf->SetAutoPageBreak( false );

    // Add custom font

    $custom_font = apply_filters( ‘sensei_certificates_custom_font’, false );
    if( $custom_font ) {
    if( isset( $custom_font[‘family’] ) && isset( $custom_font[‘file’] ) ) {
    $fpdf->AddFont( $custom_font[‘family’], ”, $custom_font[‘file’], true );
    }
    } else {
    // Add multibyte font
    $fpdf->AddFont( ‘DejaVu’, ”, ‘DejaVuSansCondensed.ttf’, true );
    }

    // Set the border image as the background
    $fpdf->Image( $image, 0, 0, $image_attr[0], $image_attr[1] );

    do_action( ‘sensei_certificates_before_pdf_output’, $this, $fpdf );
    // save the pdf as a file
    $fpdf->Output(‘F’, $path);

    • This topic was modified 3 years, 3 months ago by matthijs12345.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @theass ,

    We normally can’t help with custom code like, as it’s outside our scope of support.

    That said, I’m not quite sure what you’e trying to do here. Certificates includes the ability to email the student upon course completion. Can you let us know what your code is doing differently?

    How are you adding the code (ie, in functions.php, a plugin, etc?)

    Not sure if we can provide any assistance here, but hopefully we can get you pointed in the right direction with a bit more information.

    Best,
    Cena

    Hi,

    Since its been more than 2 weeks since your last reply, I will mark this thread resolved.

    If you’re still having any trouble, please feel free to open a new thread!

    Best,
    Cena

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Attach certificate to email’ is closed to new replies.