LLMS_Certificate::create( string $content )
Create Certificate
Description Description
Parameters Parameters
- $content
-
(string) (Required) [html formatted post content]
Return Return
(void)
Source Source
File: includes/class.llms.certificate.php
public 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' ), ) ); } /** * Allow 3rd parties to hook into the generation of an achievement * Notifications uses this * note 3rd param $this->lesson_id is actually the related post id (but misnamed) */ do_action( 'llms_user_earned_certificate', $this->userid, $new_user_certificate_id, $this->lesson_id ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: