Last active
December 13, 2023 16:02
-
-
Save adeel-raza/680d23811088777343dda2e42d2e7384 to your computer and use it in GitHub Desktop.
Uppercase First Name, Last Name or User Login Name on LearnDash LMS Certificates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'learndash_usermeta_shortcode_field_value_display', 'ee_learndash_usermeta_shortcode_field_value_display_callback', 10, 2 ); | |
function ee_learndash_usermeta_shortcode_field_value_display_callback( $value, $attr ) { | |
global $post; | |
// Don't apply logic if not on a certificate | |
if ( isset( $post->post_type ) ) { | |
$is_certificate_page = $post->post_type; | |
if ( 'sfwd-certificates' != $is_certificate_page ) { | |
return $value; | |
} | |
} | |
$user_name_fields = array( 'user_login', 'first_last_name', 'nickname', 'user_nicename', 'display_name', 'first_name', 'last_name' ); | |
if ( in_array( $attr['field'], $user_name_fields ) ) { | |
return strtoupper( $value ); | |
} | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place this snippet in your child theme's functions.php file