Warning: This method has been deprecated. LLMS_Certificate::get_title() is deprecated with no replacement instead.

Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Certificate::create( string $content )

Create Certificate


Parameters Parameters

$content

(string) (Required) HTML formatted post content.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class.llms.certificate.php

236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
private function create( $content ) {
    global $wpdb;
 
    $new_user_certificate = apply_filters(
        'lifterlms_new_page',
        array(
            'post_type'    => 'llms_my_certificate',
            'post_title'   => $this->title,
            'post_content' => $content,
            'post_status'  => 'publish',
            'post_author'  => 1,
        )
    );
 
    $new_user_certificate_id = wp_insert_post( $new_user_certificate, true );
 
    update_post_meta( $new_user_certificate_id, '_llms_certificate_title', $this->certificate_title );
    update_post_meta( $new_user_certificate_id, '_llms_certificate_image', $this->image );
    update_post_meta( $new_user_certificate_id, '_llms_certificate_template', $this->certificate_template_id );
 
    $user_metadatas = array(
        '_certificate_earned' => $new_user_certificate_id,
    );
 
    foreach ( $user_metadatas as $key => $value ) {
        $update_user_postmeta = $wpdb->insert(
            $wpdb->prefix . 'lifterlms_user_postmeta',
            array(
                'user_id'      => $this->userid,
                'post_id'      => $this->lesson_id,
                'meta_key'     => $key,
                'meta_value'   => $value,
                'updated_date' => current_time( 'mysql' ),
            )
        );
    }
 
    // This hook is documented in includes/class-llms-engagement-handler.php.
    do_action( 'llms_user_earned_certificate', $this->userid, $new_user_certificate_id, $this->lesson_id );
 
}

Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 LLMS_Certificate::get_title() is deprecated with no replacement.
3.8.0 Unknown.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.