How can I add my own shortcode that displays a custom value as document number i
-
Hello, I have created my own shortcode that shows the Document Number value for the user registered in tutor lms, the shortcode works correctly in wordpress. But, if I include it in a text field in the certificate constructor, when generating the certificate it does not get the value. It only shows the shortcode. How can I have the value of the document number field printed through the shortcode in the certificate?
The code used for the shortcode is the following:
<code>function obtener_tipo_documento_usuario_certificado() {
if ( is_user_logged_in() && function_exists(‘tutor_utils’)) {
$user_id = get_current_user_id();
$course_id = tutor_utils()->course_id();
$document_type = get_user_meta($user_id, ‘_u_document_type’, true);if (!empty($document_type)) { return $document_type; } else { return 'No se ha encontrado el tipo de documento del usuario.'; } } else { return 'El usuario no ha iniciado sesión o Tutor LMS no está activo.'; }
}
add_shortcode(‘tipo_documento_usuario_certificado’, ‘obtener_tipo_documento_usuario_certificado’);function obtener_numero_documento_usuario_certificado() {
if ( is_user_logged_in() && function_exists(‘tutor_utils’)) {
$user_id = get_current_user_id();
$course_id = tutor_utils()->course_id();
$document_numb = get_user_meta($user_id, ‘_u_document_numb’, true);if (!empty($document_numb)) { return $document_numb; } else { return 'No se ha encontrado el número de documento del usuario.'; } } else { return 'El usuario no ha iniciado sesión o Tutor LMS no está activo.'; }
}
add_shortcode(‘numero_documento_usuario_certificado’, ‘obtener_numero_documento_usuario_certificado’);</code>
Here you can see that if the values are printed in WordPress: https://prnt.sc/nUTeqV0CdOGK and screenshot of the certificate where the shortcodes don’t work.
https://prnt.sc/hm5VzjnfsKiMThe page I need help with: [log in to see the link]
- The topic ‘How can I add my own shortcode that displays a custom value as document number i’ is closed to new replies.