Certificate Builer

The Certificate Builder addon provides filters that let you customize the fields displayed on certificates and control the data used in certificate rendering. Use these hooks to add, modify, or remove certificate field values.

Filters

  1. stm_certificates_fields

Type: filter What it does: lets you modify the default fields shown when editing the certificate preview Parameters:

  • $fields (array) list of field definitions

Return: array of updated fields

Example:

add_filter( 'stm_certificates_fields', 'stm_certificates_fields_function' );

function stm_certificates_fields_function( $fields ) {
$user_id = get_current_user_id();
if ( $user_id == 33 ) {
    $fields['course_name'] = array(
       'name'  => 'Course name',
       'value' => '-Course name-',
    );
}

return $fields;
}
  1. masterstudy_lms_certificate_fields_data

Type: filter What it does: allows customization of the internal values of the certificate Parameters:

  • $fields (array) list of certificate data values

  • $certificate (array) current certificate data

Return: array of updated certificate data

Example:

add_filter( 'masterstudy_lms_certificate_fields_data', 'masterstudy_lms_certificate_fields_data_function', 10, 2 );

function masterstudy_lms_certificate_fields_data_function( $fields, $certificate ) {
	$user_id = get_current_user_id();
	if ( $user_id == 1 ) {
		$fields[] = array( 'content' => 'Custom course name' );
	}
	return $fields;
}

Last updated

Was this helpful?