• Resolved fdt2208

    (@fdt2208)


    We have a field in woocommerce that we need to display on the certificate.

    We were previously able to do this but since LifterLMS 6 this no longer works.

    How do we display this field in addition to the merge codes shown in the certificate builder? Are there any example or reference code available we can use in the customizations plugin?

    • This topic was modified 2 years, 6 months ago by fdt2208.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @fdt2208

    Thanks for reaching out and we’re sorry you’re having this issue!

    Yes, we do have this custom merge code example you can use to add a custom merge code for the certificate:

     * Add custom merge codes to an LLMS certificate
     * @param    int   $user_id          WP_User ID
     * @param    int   $cert_id          WP_Post ID of the generated certificate
     * @param    int   $related_post_id  WP_Post ID of the post which triggered the certificate generation
     * @return   void
     */
    function my_custom_cert_merge_codes( $user_id, $cert_id, $related_post_id ) {
    		
    	$cert_post = get_post( $cert_id );
    
    	$content = str_replace( '{your_merge_code}', get_user_meta( $user_id, 'your_user_meta_key', true ), $cert_post->post_content );
    
    	wp_update_post( array(
    		'ID' => $cert_id,
    		'post_content' => $content
    	) );
    
    }
    add_action( 'llms_user_earned_certificate', 'my_custom_cert_merge_codes', 999, 3 );

    Please do test this on a dev or staging site before adding to your production site to make sure everything works with your set up!

    Let us know if you have any further questions.

    All the best,

    Since I haven’t heard back from you in a week I’m going to mark this thread as resolved. Don’t worry, if you have more questions or still need help just hit reply and let me know!

    Have a great day!

    Thread Starter fdt2208

    (@fdt2208)

    Hi Natalie,

    Sorry for being slow in responding.

    This code no longer works. We used to use this code but since LLMS v 6 it stopped working.

    I was advised by support and they responded with:

    You will want to use this filter instead:
    llms_certificate_merge_data

    This will conform with the 6.0 update!

    I am looking for example code that uses this new filter.

    Will be great if you can assist.

    Thread Starter fdt2208

    (@fdt2208)

    Hi @nrherron

    I have not had a reply to my further comment. If you can please assist?

    Appreciate it.

    Francois

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show custom field in Certificate’ is closed to new replies.