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
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | 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. |