• Hi There,

    So I have extended field with a unique ID number. I need to show this number on a Learndash Certificate.

    I have tried this solution

    add_shortcode( 'xprofile_field_data', function ( $atts = array(), $content = '' ) {
    	$atts = shortcode_atts( array(
    		'field'   => '',
    		'user_id' => get_current_user_id(),
    	), $atts );
    
    	if ( empty( $atts['field'] ) ) {
    		return '';
    	}
    
    	return xprofile_get_field_data( $atts['field'], $atts['user_id'], 'comma' );
    } );

    Then using a shortcode [bp_xprofile_field_data field=3] to pull in that Field value but its not working.

    Certificate screenshot

    Any advice how to pull in a specific field value to display on learndash Certificates?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author BuddyDev

    (@buddydev)

    Hi,
    Thank you for the question.

    Your shortcode is correct. It seems the certificate generation plugin is not parsing the shortcode. Please contact them and ask if they can support shortcodes.

    Regards
    Brajesh

    Thread Starter Andrew

    (@flatmonk3y)

    It does support shortcodes because the date and the Full name and Last names are being generated with shortcodes

    Plugin Author BuddyDev

    (@buddydev)

    Hi,
    From your screenshot, the shortcode is output as it is, that’s why I suggested to check with them.

    If shortcodes work in certificate and this one is simply outputting the shortcode as text, it means the code you are registering for the shortcode is not available/enabled when generating certificate.

    I do not use the LMS plugin, So I don’t have a definitive reason why it won’t work. I will suggest you to try putting the code in your theme’s functions.php or in a plugin file and recheck(probably by regenrating the certificate).

    Regards
    Brajesh

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom field from BuddyPress Extended Profile’ is closed to new replies.