Warning: This method has been deprecated. LLMS_Achievement::create() 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_Achievement::create( string $content )
Create the achievement
Parameters Parameters
- $content
-
(string) (Required) Achievement body content.
Return Return
(void)
Source Source
File: includes/class.llms.achievement.php
private function create( $content ) { global $wpdb; $new_user_achievement = apply_filters( 'lifterlms_new_achievement', array( 'post_type' => 'llms_my_achievement', 'post_title' => $this->title, 'post_content' => $content, 'post_status' => 'publish', 'post_author' => 1, ) ); $new_user_achievement_id = wp_insert_post( $new_user_achievement, true ); update_post_meta( $new_user_achievement_id, '_llms_achievement_title', $this->achievement_title ); update_post_meta( $new_user_achievement_id, '_llms_achievement_image', $this->image ); update_post_meta( $new_user_achievement_id, '_llms_achievement_content', $this->content ); update_post_meta( $new_user_achievement_id, '_llms_achievement_template', $this->achievement_template_id ); $user_metadatas = array( '_achievement_earned' => $new_user_achievement_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_achievement', $this->userid, $new_user_achievement_id, $this->lesson_id ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
6.0.0 | LLMS_Achievement::create() is deprecated with no replacement. |
3.8.0 | Unknown |
1.0.0 | Introduced. |