Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Certificates::generate_export( string $filepath, int $certificate_id )

Generate a downloadable HTML file for a certificate


Description Description


Parameters Parameters

$filepath

(string) (Required) full path for the created file

$certificate_id

(int) (Required) WP Post ID of the earned certificate


Top ↑

Return Return

(mixed) WP_Error or full path to the generated export


Top ↑

Source Source

File: includes/class.llms.certificates.php

	private function generate_export( $filepath, $certificate_id ) {

		$html = $this->get_export_html( $certificate_id );

		if ( is_wp_error( $html ) ) {
			return $html;
		}

		$file = fopen( $filepath, 'w' );
		if ( false === $file ) {
			return new WP_Error( __( 'Unable to open export file (HTML certificate) for writing.', 'lifterlms' ) );
		}

		if ( false === fwrite( $file, $html ) ) {
			return new WP_Error( __( 'Unable to write to export file (HTML certificate).', 'lifterlms' ) );
		}

		fclose( $file );

		return $filepath;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.18.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.