Filter uncanny-automator-pro

learndash_pdf_creator

Filters the value of pdf creator. Filters the PDF creator's name before a LearnDash certificate PDF is generated.

add_filter( 'learndash_pdf_creator', $callback, 10, 1 );

Description

This filter hook allows developers to dynamically change the PDF creator's name used by LearnDash certificates. It fires when a PDF certificate is being generated, providing access to the PDF object and certificate ID. Developers can modify the `$pdf_creator` string to brand certificates or inject custom creator information.


Usage

add_filter( 'learndash_pdf_creator', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

add_filter( 'learndash_pdf_creator', 'my_custom_learndash_pdf_creator', 10, 3 );

/**
 * Changes the PDF creator name for LearnDash certificates.
 *
 * This example appends the current user's display name to the default PDF creator.
 *
 * @param string   $pdf_creator The default PDF creator name.
 * @param TCPDF   $pdf         The TCPDF class instance.
 * @param int      $cert_id     The certificate post ID.
 * @return string  The modified PDF creator name.
 */
function my_custom_learndash_pdf_creator( $pdf_creator, $pdf, $cert_id ) {
    if ( is_user_logged_in() ) {
        $current_user = wp_get_current_user();
        $pdf_creator .= ' - User: ' . $current_user->display_name;
    }
    // Optionally, you could also use the $cert_id to dynamically change the creator
    // For example: $pdf_creator .= ' - CertID:' . $cert_id;

    return $pdf_creator;
}

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

uncanny-automator-pro/src/integrations/learndash/helpers/learndash-pro-helpers.php:990

/**
		 * Filters the value of pdf creator.
		 *
		 * @param string $pdf_creator The name of the PDF creator.
		 * @param TCPDF $pdf `TCPDF` class instance.
		 * @param int $cert_id Certificate post ID.
		 */
		$pdf->SetCreator( apply_filters( 'learndash_pdf_creator', PDF_CREATOR, $pdf, $cert_args['cert_id'] ) );

		/**
		 * Filters the name of the pdf author.
		 *
		 * @param string $pdf_author_name PDF author name.
		 * @param TCPDF $pdf `TCPDF` class instance.
		 * @param int $cert_id Certificate post ID.


Scroll to Top