Filter uncanny-toolkit-pro

uo_download_certificate_types

Filters the available certificate types and their labels before they are displayed in the download certificate options.

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

Description

Filters the available certificate types for bulk download. Developers can use this hook to add, remove, or modify the types of certificates that users can select to download, such as group, course, or quiz certificates. This filter runs after the default types are defined but before they are used in the dropdown.


Usage

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

Parameters

$group_label (mixed)
This parameter contains the current label for the certificate type dropdown, which can be modified by filters.

Return Value

The filtered value.


Examples

<?php
/**
 * Example of filtering the certificate types available for download.
 * This example adds a new certificate type 'lesson' and customizes
 * the label for the existing 'group' type.
 *
 * @param array $certificate_types An associative array of certificate types and their labels.
 * @return array The modified array of certificate types.
 */
add_filter( 'uo_download_certificate_types', 'my_custom_certificate_types', 10, 1 );

function my_custom_certificate_types( $certificate_types ) {
    // Add a new certificate type 'lesson'
    $certificate_types['lesson'] = __( 'Lesson Completion Certificates', 'my-text-domain' );

    // Customize the label for the 'group' certificate type
    if ( isset( $certificate_types['group'] ) ) {
        $certificate_types['group'] = __( 'Group Enrollment Certificates', 'my-text-domain' );
    }

    // Remove a certificate type if it exists (e.g., if 'quiz' is not needed)
    if ( isset( $certificate_types['quiz'] ) ) {
        unset( $certificate_types['quiz'] );
    }

    return $certificate_types;
}

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

src/classes/download-certificates-in-bulk.php:1219

<div class="ultp-download-certificates-filter uo-dropdowns-certificates"
								 id="ultp-download-certificates-filter-type">
								<label
									for="uo_certificatesdropdown_select"><?php esc_html_e( 'Certificate type', 'uncanny-pro-toolkit' ); ?></label><br/>

								<?php
								$valid_certificate_types = array( 'group', 'course', 'quiz' );
								$certificate_types       = apply_filters( 'uo_download_certificate_types',
									array(
										'group'  => sprintf( esc_html__( '%s certificates', 'uncanny-pro-toolkit' ), $group_label ),
										'course' => sprintf( esc_html__( '%s certificates', 'uncanny-pro-toolkit' ), $course_label ),
										'quiz'   => sprintf( esc_html__( '%s certificates', 'uncanny-pro-toolkit' ), $quiz_label ),
									)
								);
								?>


Scroll to Top