Hi,
I’m now trying to add the certificate as an attachment. However, I’m struggling a little with invoking other files and directing to other classes. Can you please help me with the following code I put in class.lpr-email.php in function send:
public function send() {
$email_settings = get_option( ‘_lpr_settings_emails’ );
$headers[] = ‘Content-Type: text/html; charset=UTF-8’;
$headers[‘from’] = ”;
$headers[‘bcc’] = ‘Bcc: [email protected]’;
$user_id = get_current_user_id();
$course_id = get_transient( ‘learn_press_user_finished_course_’ . $user_id );
if( LPR_Certificate::learn_press_user_has_passed_course( $course_id, $user_id))
{
$attachment = LPR_Certificate::learn_press_certificate_download_url( $course_id, $user_id );
}
else
{
$attachment = “”;
}
if ( is_array( $email_settings[‘general’] ) && !empty( $email_settings[‘general’][‘from_email’] ) )
{
$headers[‘from’] .= ‘From:’;
if ( !empty( $email_settings[‘general’][‘from_name’] ) ) {
$headers[‘from’] .= ‘ ‘ . $this->filter( $email_settings[‘general’][‘from_name’] );
}
$headers[‘from’] .= ‘ <‘ . sanitize_email( $email_settings[‘general’][‘from_email’] ).”>\r\n”;
}
delete_transient( ‘learn_press_user_finished_course_’ . $user_id );
return wp_mail( $this->to, $this->filter( $this->subject ), stripslashes( $this->message ), $headers, $attachment);
}