LLMS_User_Postmeta::get_description( string $context = 'course' )
Get a string used to describe the postmeta item.
Parameters Parameters
- $context
-
(string) (Optional) Display context either "course" or "student".
Default value: 'course'
Return Return
(string)
Source Source
File: includes/models/model.llms.user.postmeta.php
public function get_description( $context = 'course' ) { $key = $this->get( 'meta_key' ); $student = $this->get_student(); $name = $student ? $student->get( 'display_name' ) : __( '[Deleted]', 'lifterlms' ); $post = llms_get_post( $this->get( 'post_id' ) ); $label = is_a( $post, 'LLMS_Post_Model' ) ? strtolower( $post->get_post_type_label() ) : __( 'quiz', 'lifterlms' ); $post_name = ( 'course' === $context ) ? $label : sprintf( '%1$s "%2$s"', $label, get_the_title( $this->get( 'post_id' ) ) ); $string = ''; switch ( $key ) { case '_achievement_earned': $string = sprintf( __( '%1$s earned the achievement "%2$s"', 'lifterlms' ), $name, get_the_title( $this->get( 'meta_value' ) ) ); break; case '_certificate_earned': $string = sprintf( __( '%1$s earned the certificate "%2$s"', 'lifterlms' ), $name, get_the_title( $this->get( 'meta_value' ) ) ); break; case '_email_sent': $string = sprintf( __( 'Email "%1$s" was sent to %2$s', 'lifterlms' ), get_the_title( $this->get( 'meta_value' ) ), $name ); break; case '_enrollment_trigger': $string = sprintf( __( '%1$s purchased the %2$s', 'lifterlms' ), $name, $post_name ); break; case '_status': if ( 'enrolled' === $this->get( 'meta_value' ) ) { $string = sprintf( __( '%1$s enrolled into the %2$s', 'lifterlms' ), $name, $post_name ); } else { $string = sprintf( __( '%1$s unenrolled from the %2$s', 'lifterlms' ), $name, $post_name ); } break; case '_is_complete': $string = sprintf( __( '%1$s completed the %2$s', 'lifterlms' ), $name, $post_name ); break; }// End switch(). return $string; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.15.0 | Introduced. |