@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Generates content for a single row of the table in the user management |
208 | - * screen. |
|
209 | - * |
|
208 | + * screen. |
|
209 | + * |
|
210 | 210 | * @since 1.7.0 |
211 | - * |
|
211 | + * |
|
212 | 212 | * @param object $item The current item |
213 | - * |
|
214 | - * @return void |
|
213 | + * |
|
214 | + * @return void |
|
215 | 215 | */ |
216 | 216 | protected function get_row_data( $item ) { |
217 | 217 | global $wp_version; |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | switch ( $this->view ) { |
220 | 220 | case 'learners' : |
221 | 221 | |
222 | - // in this case the item passed in is actually the users activity on course of lesson |
|
223 | - $user_activity = $item; |
|
222 | + // in this case the item passed in is actually the users activity on course of lesson |
|
223 | + $user_activity = $item; |
|
224 | 224 | $post_id = false; |
225 | 225 | |
226 | 226 | if( $this->lesson_id ) { |
@@ -239,30 +239,30 @@ discard block |
||
239 | 239 | |
240 | 240 | if( 'complete' == $user_activity->comment_approved || 'graded' == $user_activity->comment_approved || 'passed' == $user_activity->comment_approved ) { |
241 | 241 | |
242 | - $status_html = '<span class="graded">' .__( 'Completed', 'woothemes-sensei' ) . '</span>'; |
|
242 | + $status_html = '<span class="graded">' .__( 'Completed', 'woothemes-sensei' ) . '</span>'; |
|
243 | 243 | |
244 | 244 | } else { |
245 | 245 | |
246 | - $status_html = '<span class="in-progress">' . __( 'In Progress', 'woothemes-sensei' ) . '</span>'; |
|
246 | + $status_html = '<span class="in-progress">' . __( 'In Progress', 'woothemes-sensei' ) . '</span>'; |
|
247 | 247 | |
248 | 248 | } |
249 | 249 | |
250 | - $title = Sensei_Learner::get_full_name( $user_activity->user_id ); |
|
250 | + $title = Sensei_Learner::get_full_name( $user_activity->user_id ); |
|
251 | 251 | $a_title = sprintf( __( 'Edit “%s”' ), $title ); |
252 | 252 | |
253 | - /** |
|
254 | - * sensei_learners_main_column_data filter |
|
255 | - * |
|
256 | - * This filter runs on the learner management screen for a specific course. |
|
257 | - * It provides the learner row column details. |
|
258 | - * |
|
259 | - * @param array $columns{ |
|
260 | - * type string $title |
|
261 | - * type string $date_started |
|
262 | - * type string $course_status (completed, started etc) |
|
263 | - * type html $action_buttons |
|
264 | - * } |
|
265 | - */ |
|
253 | + /** |
|
254 | + * sensei_learners_main_column_data filter |
|
255 | + * |
|
256 | + * This filter runs on the learner management screen for a specific course. |
|
257 | + * It provides the learner row column details. |
|
258 | + * |
|
259 | + * @param array $columns{ |
|
260 | + * type string $title |
|
261 | + * type string $date_started |
|
262 | + * type string $course_status (completed, started etc) |
|
263 | + * type html $action_buttons |
|
264 | + * } |
|
265 | + */ |
|
266 | 266 | $column_data = apply_filters( 'sensei_learners_main_column_data', array( |
267 | 267 | 'title' => '<strong><a class="row-title" href="' . admin_url( 'user-edit.php?user_id=' . $user_activity->user_id ) . '" title="' . esc_attr( $a_title ) . '">' . $title . '</a></strong>', |
268 | 268 | 'date_started' => get_comment_meta( $user_activity->comment_ID, 'start', true), |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | |
293 | 293 | case 'courses' : |
294 | 294 | default: |
295 | - $course_learners = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_learners_course_learners', array( 'post_id' => $item->ID, 'type' => 'sensei_course_status', 'status' => 'any' ) ) ); |
|
295 | + $course_learners = Sensei_Utils::sensei_check_for_activity( apply_filters( 'sensei_learners_course_learners', array( 'post_id' => $item->ID, 'type' => 'sensei_course_status', 'status' => 'any' ) ) ); |
|
296 | 296 | $title = get_the_title( $item ); |
297 | 297 | $a_title = sprintf( __( 'Edit “%s”' ), $title ); |
298 | 298 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @since 1.6.0 |
22 | 22 | */ |
23 | 23 | public function __construct () { |
24 | - $this->token = 'messages'; |
|
24 | + $this->token = 'messages'; |
|
25 | 25 | $this->post_type = 'sensei_message'; |
26 | 26 | $this->meta_fields = array( 'sender', 'receiver' ); |
27 | 27 | |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | // Monitor when new reply is posted |
37 | 37 | add_action( 'comment_post', array( $this, 'message_reply_received' ), 10, 1 ); |
38 | 38 | |
39 | - // Block WordPress from sending comment update emails for the messages post type |
|
40 | - add_filter('comment_notification_recipients', array( $this, 'stop_wp_comment_emails' ), 20, 2 ); |
|
39 | + // Block WordPress from sending comment update emails for the messages post type |
|
40 | + add_filter('comment_notification_recipients', array( $this, 'stop_wp_comment_emails' ), 20, 2 ); |
|
41 | 41 | |
42 | - // Block WordPress from sending comment moderator emails on the sensei messages post types |
|
43 | - add_filter('comment_moderation_recipients', array( $this, 'stop_wp_comment_emails' ), 20, 2 ); |
|
42 | + // Block WordPress from sending comment moderator emails on the sensei messages post types |
|
43 | + add_filter('comment_moderation_recipients', array( $this, 'stop_wp_comment_emails' ), 20, 2 ); |
|
44 | 44 | |
45 | 45 | // Process saving of message posts |
46 | 46 | add_action( 'save_post', array( $this, 'save_message' ) ); |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | // Add message links to courses & lessons |
49 | 49 | add_action( 'sensei_single_course_content_inside_before', array( $this, 'send_message_link' ), 35 ); |
50 | 50 | |
51 | - // add message link to lesson |
|
52 | - add_action( 'sensei_single_lesson_content_inside_before', array( $this, 'send_message_link' ), 30, 2 ); |
|
51 | + // add message link to lesson |
|
52 | + add_action( 'sensei_single_lesson_content_inside_before', array( $this, 'send_message_link' ), 30, 2 ); |
|
53 | 53 | |
54 | - // add message link to lesson |
|
55 | - add_action( 'sensei_single_quiz_questions_before', array( $this, 'send_message_link' ), 10, 2 ); |
|
54 | + // add message link to lesson |
|
55 | + add_action( 'sensei_single_quiz_questions_before', array( $this, 'send_message_link' ), 10, 2 ); |
|
56 | 56 | |
57 | 57 | // Hide messages and replies from users who do not have access |
58 | - add_action( 'template_redirect', array( $this, 'message_login' ), 10, 1 ); |
|
59 | - add_action( 'pre_get_posts', array( $this, 'message_list' ), 10, 1 ); |
|
60 | - add_filter( 'the_title', array( $this, 'message_title' ), 10, 2 ); |
|
61 | - add_filter( 'the_content', array( $this, 'message_content' ), 10, 1 ); |
|
62 | - add_filter( 'comments_array', array( $this, 'message_replies' ), 100, 1 ); |
|
63 | - add_filter( 'get_comments_number', array( $this, 'message_reply_count' ), 100, 2 ); |
|
64 | - add_filter( 'comments_open', array( $this, 'message_replies_open' ), 100, 2 ); |
|
58 | + add_action( 'template_redirect', array( $this, 'message_login' ), 10, 1 ); |
|
59 | + add_action( 'pre_get_posts', array( $this, 'message_list' ), 10, 1 ); |
|
60 | + add_filter( 'the_title', array( $this, 'message_title' ), 10, 2 ); |
|
61 | + add_filter( 'the_content', array( $this, 'message_content' ), 10, 1 ); |
|
62 | + add_filter( 'comments_array', array( $this, 'message_replies' ), 100, 1 ); |
|
63 | + add_filter( 'get_comments_number', array( $this, 'message_reply_count' ), 100, 2 ); |
|
64 | + add_filter( 'comments_open', array( $this, 'message_replies_open' ), 100, 2 ); |
|
65 | 65 | } // End __construct() |
66 | 66 | |
67 | 67 | public function add_menu_item() { |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | public function send_message_link( $post_id = 0, $user_id = 0 ) { |
163 | 163 | global $post; |
164 | 164 | |
165 | - // only show the link for the allowed post types: |
|
166 | - $allowed_post_types = array('lesson', 'course', 'quiz'); |
|
165 | + // only show the link for the allowed post types: |
|
166 | + $allowed_post_types = array('lesson', 'course', 'quiz'); |
|
167 | 167 | if ( ! in_array( get_post_type() , $allowed_post_types ) ) { |
168 | 168 | |
169 | 169 | return; |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | } elseif( 'course' == $post->post_type ) { |
187 | 187 | $contact_button_text = __( 'Contact Course Teacher', 'woothemes-sensei' ); |
188 | 188 | }else{ |
189 | - $contact_button_text = __( 'Contact Teacher', 'woothemes-sensei' ); |
|
190 | - } |
|
189 | + $contact_button_text = __( 'Contact Teacher', 'woothemes-sensei' ); |
|
190 | + } |
|
191 | 191 | |
192 | 192 | $html .= '<p><a class="button send-message-button" href="' . esc_url($href) . '#private_message">' . $contact_button_text . '</a></p>'; |
193 | 193 | } |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | |
213 | 213 | if( ! isset( $post->ID ) ) return $html; |
214 | 214 | |
215 | - //confirm private message |
|
216 | - $confirmation = ''; |
|
217 | - if( isset( $_GET[ 'send' ] ) && 'complete' == $_GET[ 'send' ] ) { |
|
215 | + //confirm private message |
|
216 | + $confirmation = ''; |
|
217 | + if( isset( $_GET[ 'send' ] ) && 'complete' == $_GET[ 'send' ] ) { |
|
218 | 218 | |
219 | - $confirmation_message = __('Your private message has been sent.', 'woothemes-sensei'); |
|
220 | - $confirmation = '<div class="sensei-message tick">' . $confirmation_message . '</div>'; |
|
219 | + $confirmation_message = __('Your private message has been sent.', 'woothemes-sensei'); |
|
220 | + $confirmation = '<div class="sensei-message tick">' . $confirmation_message . '</div>'; |
|
221 | 221 | |
222 | - } |
|
222 | + } |
|
223 | 223 | |
224 | 224 | $html .= '<h3 id="private_message">' . __( 'Send Private Message', 'woothemes-sensei' ) . '</h3>'; |
225 | - $html .= '<p>'; |
|
226 | - $html .= $confirmation; |
|
227 | - $html .= '</p>'; |
|
225 | + $html .= '<p>'; |
|
226 | + $html .= $confirmation; |
|
227 | + $html .= '</p>'; |
|
228 | 228 | $html .= '<form name="contact-teacher" action="" method="post" class="contact-teacher">'; |
229 | 229 | $html .= '<p class="form-row form-row-wide">'; |
230 | 230 | $html .= '<textarea name="contact_message" placeholder="' . __( 'Enter your private message.', 'woothemes-sensei' ) . '"></textarea>'; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public function message_reply_received( $comment_id = 0 ) { |
256 | 256 | |
257 | 257 | // Get comment object |
258 | - $comment = get_comment( $comment_id ); |
|
258 | + $comment = get_comment( $comment_id ); |
|
259 | 259 | |
260 | 260 | if( is_null( $comment ) ) return; |
261 | 261 | |
@@ -270,87 +270,87 @@ discard block |
||
270 | 270 | do_action( 'sensei_private_message_reply', $comment, $message ); |
271 | 271 | } |
272 | 272 | |
273 | - /** |
|
274 | - * This function stops WordPress from sending the default comment update emails. |
|
275 | - * |
|
276 | - * This function is hooked into comment_notification_recipients. It will simply return |
|
277 | - * an empty array if the current passed in comment is on a message post type. |
|
278 | - * |
|
279 | - * @param array $emails |
|
280 | - * @param int $comment_id |
|
281 | - * @return array; |
|
282 | - */ |
|
283 | - public function stop_wp_comment_emails( $emails , $comment_id ){ |
|
273 | + /** |
|
274 | + * This function stops WordPress from sending the default comment update emails. |
|
275 | + * |
|
276 | + * This function is hooked into comment_notification_recipients. It will simply return |
|
277 | + * an empty array if the current passed in comment is on a message post type. |
|
278 | + * |
|
279 | + * @param array $emails |
|
280 | + * @param int $comment_id |
|
281 | + * @return array; |
|
282 | + */ |
|
283 | + public function stop_wp_comment_emails( $emails , $comment_id ){ |
|
284 | 284 | |
285 | - $comment = get_comment( $comment_id ); |
|
286 | - if( isset( $comment->comment_post_ID ) && |
|
287 | - 'sensei_message' == get_post_type( $comment->comment_post_ID ) ){ |
|
285 | + $comment = get_comment( $comment_id ); |
|
286 | + if( isset( $comment->comment_post_ID ) && |
|
287 | + 'sensei_message' == get_post_type( $comment->comment_post_ID ) ){ |
|
288 | 288 | |
289 | - // empty the emails array to ensure no emails are sent for this comment |
|
290 | - $emails = array(); |
|
289 | + // empty the emails array to ensure no emails are sent for this comment |
|
290 | + $emails = array(); |
|
291 | 291 | |
292 | - } |
|
293 | - return $emails; |
|
292 | + } |
|
293 | + return $emails; |
|
294 | 294 | |
295 | - }// end stop_wp_comment_emails |
|
295 | + }// end stop_wp_comment_emails |
|
296 | 296 | |
297 | 297 | /** |
298 | - * Save new message post |
|
299 | - * @param integer $sender_id ID of sender |
|
300 | - * @param integer $receiver_id ID of receiver |
|
301 | - * @param string $message Message content |
|
302 | - * @param string $post_id ID of post related to message |
|
303 | - * @return mixed Message ID on success, boolean false on failure |
|
304 | - */ |
|
305 | - private function save_new_message_post( $sender_id = 0, $receiver_id = 0, $message = '', $post_id = 0 ) { |
|
298 | + * Save new message post |
|
299 | + * @param integer $sender_id ID of sender |
|
300 | + * @param integer $receiver_id ID of receiver |
|
301 | + * @param string $message Message content |
|
302 | + * @param string $post_id ID of post related to message |
|
303 | + * @return mixed Message ID on success, boolean false on failure |
|
304 | + */ |
|
305 | + private function save_new_message_post( $sender_id = 0, $receiver_id = 0, $message = '', $post_id = 0 ) { |
|
306 | 306 | |
307 | - $message_id = false; |
|
307 | + $message_id = false; |
|
308 | 308 | |
309 | - if( $sender_id && $receiver_id && $message && $post_id ) { |
|
309 | + if( $sender_id && $receiver_id && $message && $post_id ) { |
|
310 | 310 | |
311 | - $title = wp_trim_words( $message, 8, '...' ); |
|
311 | + $title = wp_trim_words( $message, 8, '...' ); |
|
312 | 312 | |
313 | - // Set up post data for message |
|
314 | - $message_data = array( |
|
315 | - 'post_type' => $this->post_type, |
|
316 | - 'post_title' => esc_html( $title ), |
|
317 | - 'post_content' => esc_html( $message ), |
|
318 | - 'post_status' => 'publish', |
|
319 | - 'ping_status' => 'closed', |
|
320 | - 'comment_status' => 'open', |
|
321 | - 'post_excerpt' => '', |
|
322 | - 'post_author' => intval( $sender_id ) |
|
323 | - ); |
|
313 | + // Set up post data for message |
|
314 | + $message_data = array( |
|
315 | + 'post_type' => $this->post_type, |
|
316 | + 'post_title' => esc_html( $title ), |
|
317 | + 'post_content' => esc_html( $message ), |
|
318 | + 'post_status' => 'publish', |
|
319 | + 'ping_status' => 'closed', |
|
320 | + 'comment_status' => 'open', |
|
321 | + 'post_excerpt' => '', |
|
322 | + 'post_author' => intval( $sender_id ) |
|
323 | + ); |
|
324 | 324 | |
325 | - // Insert post |
|
326 | - $message_id = wp_insert_post( $message_data ); |
|
325 | + // Insert post |
|
326 | + $message_id = wp_insert_post( $message_data ); |
|
327 | 327 | |
328 | - if( ! is_wp_error( $message_id ) ) { |
|
328 | + if( ! is_wp_error( $message_id ) ) { |
|
329 | 329 | |
330 | - // Add sender to message meta |
|
331 | - $sender = get_userdata( $sender_id ); |
|
332 | - add_post_meta( $message_id, '_sender', $sender->user_login ); |
|
330 | + // Add sender to message meta |
|
331 | + $sender = get_userdata( $sender_id ); |
|
332 | + add_post_meta( $message_id, '_sender', $sender->user_login ); |
|
333 | 333 | |
334 | - // Add receiver to message meta |
|
335 | - $receiver = get_userdata( $receiver_id ); |
|
336 | - add_post_meta( $message_id, '_receiver', $receiver->user_login ); |
|
334 | + // Add receiver to message meta |
|
335 | + $receiver = get_userdata( $receiver_id ); |
|
336 | + add_post_meta( $message_id, '_receiver', $receiver->user_login ); |
|
337 | 337 | |
338 | - // Add lesson/course ID to message meta |
|
339 | - $post = get_post( $post_id ); |
|
340 | - add_post_meta( $message_id, '_posttype', $post->post_type ); |
|
341 | - add_post_meta( $message_id, '_post', $post->ID ); |
|
338 | + // Add lesson/course ID to message meta |
|
339 | + $post = get_post( $post_id ); |
|
340 | + add_post_meta( $message_id, '_posttype', $post->post_type ); |
|
341 | + add_post_meta( $message_id, '_post', $post->ID ); |
|
342 | 342 | |
343 | - do_action( 'sensei_new_private_message', $message_id ); |
|
343 | + do_action( 'sensei_new_private_message', $message_id ); |
|
344 | 344 | |
345 | - } else { |
|
345 | + } else { |
|
346 | 346 | |
347 | - $message_id = false; |
|
347 | + $message_id = false; |
|
348 | 348 | |
349 | - } |
|
350 | - } |
|
349 | + } |
|
350 | + } |
|
351 | 351 | |
352 | - return $message_id; |
|
353 | - } |
|
352 | + return $message_id; |
|
353 | + } |
|
354 | 354 | |
355 | 355 | /** |
356 | 356 | * Check if user has access to view this message |
@@ -389,56 +389,56 @@ discard block |
||
389 | 389 | remove_meta_box('commentstatusdiv', $this->post_type, 'normal'); |
390 | 390 | } |
391 | 391 | |
392 | - /** |
|
393 | - * Function message_login() |
|
394 | - * |
|
395 | - * Only show /messages/* to logged in users, and |
|
396 | - * redirect logged out users to wp-login.php |
|
397 | - * |
|
398 | - * @since 1.9.0 |
|
399 | - * @param none |
|
400 | - * @return void |
|
401 | - */ |
|
392 | + /** |
|
393 | + * Function message_login() |
|
394 | + * |
|
395 | + * Only show /messages/* to logged in users, and |
|
396 | + * redirect logged out users to wp-login.php |
|
397 | + * |
|
398 | + * @since 1.9.0 |
|
399 | + * @param none |
|
400 | + * @return void |
|
401 | + */ |
|
402 | 402 | |
403 | - public function message_login () { |
|
403 | + public function message_login () { |
|
404 | 404 | |
405 | - if ( is_user_logged_in() ) { |
|
405 | + if ( is_user_logged_in() ) { |
|
406 | 406 | |
407 | - return; |
|
408 | - } |
|
407 | + return; |
|
408 | + } |
|
409 | 409 | |
410 | - $settings = Sensei()->settings->get_settings(); |
|
411 | - if( isset( $settings[ 'my_course_page' ] ) |
|
412 | - && 0 < intval( $settings[ 'my_course_page' ] ) ){ |
|
410 | + $settings = Sensei()->settings->get_settings(); |
|
411 | + if( isset( $settings[ 'my_course_page' ] ) |
|
412 | + && 0 < intval( $settings[ 'my_course_page' ] ) ){ |
|
413 | 413 | |
414 | - $my_courses_page_id = $settings[ 'my_course_page' ]; |
|
414 | + $my_courses_page_id = $settings[ 'my_course_page' ]; |
|
415 | 415 | |
416 | - $my_courses_url = get_permalink($my_courses_page_id); |
|
416 | + $my_courses_url = get_permalink($my_courses_page_id); |
|
417 | 417 | |
418 | - } |
|
418 | + } |
|
419 | 419 | |
420 | - if ( is_single() && is_singular( $this->post_type ) |
|
421 | - || is_post_type_archive( $this->post_type ) ) { |
|
420 | + if ( is_single() && is_singular( $this->post_type ) |
|
421 | + || is_post_type_archive( $this->post_type ) ) { |
|
422 | 422 | |
423 | - if ( isset($my_courses_url) ) { |
|
423 | + if ( isset($my_courses_url) ) { |
|
424 | 424 | |
425 | - wp_redirect($my_courses_url, 303); |
|
426 | - exit; |
|
427 | - } |
|
425 | + wp_redirect($my_courses_url, 303); |
|
426 | + exit; |
|
427 | + } |
|
428 | 428 | |
429 | - else { |
|
429 | + else { |
|
430 | 430 | |
431 | - wp_redirect(home_url('/wp-login.php'), 303); |
|
432 | - exit; |
|
433 | - } |
|
431 | + wp_redirect(home_url('/wp-login.php'), 303); |
|
432 | + exit; |
|
433 | + } |
|
434 | 434 | |
435 | - } |
|
436 | - } |
|
435 | + } |
|
436 | + } |
|
437 | 437 | /** |
438 | - * Only show allowed messages in messages archive |
|
439 | - * @param WP_Query $query Original query |
|
440 | - * @return void |
|
441 | - */ |
|
438 | + * Only show allowed messages in messages archive |
|
439 | + * @param WP_Query $query Original query |
|
440 | + * @return void |
|
441 | + */ |
|
442 | 442 | public function message_list( $query ) { |
443 | 443 | global $current_user; |
444 | 444 | |
@@ -555,17 +555,17 @@ discard block |
||
555 | 555 | return $open; |
556 | 556 | } |
557 | 557 | |
558 | - /** |
|
559 | - * Print outthe message was sent by $sender_username on the |
|
560 | - * |
|
561 | - * @since 1.9.0 |
|
562 | - */ |
|
563 | - public static function the_message_sent_by_title(){ |
|
558 | + /** |
|
559 | + * Print outthe message was sent by $sender_username on the |
|
560 | + * |
|
561 | + * @since 1.9.0 |
|
562 | + */ |
|
563 | + public static function the_message_sent_by_title(){ |
|
564 | 564 | |
565 | - $sender_username = get_post_meta( get_the_ID() , '_sender', true ); |
|
566 | - if( $sender_username ) { |
|
565 | + $sender_username = get_post_meta( get_the_ID() , '_sender', true ); |
|
566 | + if( $sender_username ) { |
|
567 | 567 | |
568 | - $sender = get_user_by( 'login', $sender_username ); ?> |
|
568 | + $sender = get_user_by( 'login', $sender_username ); ?> |
|
569 | 569 | |
570 | 570 | <p class="message-meta"> |
571 | 571 | <small> |
@@ -577,41 +577,41 @@ discard block |
||
577 | 577 | |
578 | 578 | <?php } |
579 | 579 | |
580 | - } |
|
580 | + } |
|
581 | 581 | |
582 | - /** |
|
583 | - * sensei_single_title output for single page title |
|
584 | - * @since 1.1.0 |
|
585 | - * @return void |
|
586 | - * @deprecate |
|
587 | - */ |
|
588 | - public static function the_title() { |
|
582 | + /** |
|
583 | + * sensei_single_title output for single page title |
|
584 | + * @since 1.1.0 |
|
585 | + * @return void |
|
586 | + * @deprecate |
|
587 | + */ |
|
588 | + public static function the_title() { |
|
589 | 589 | |
590 | - global $post; |
|
590 | + global $post; |
|
591 | 591 | |
592 | - $content_post_id = get_post_meta( $post->ID, '_post', true ); |
|
593 | - if( $content_post_id ) { |
|
594 | - $title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), '<a href="' . get_permalink( $content_post_id ) . '">' . get_the_title( $content_post_id ) . '</a>' ); |
|
595 | - } else { |
|
596 | - $title = get_the_title( $post->ID ); |
|
597 | - } |
|
592 | + $content_post_id = get_post_meta( $post->ID, '_post', true ); |
|
593 | + if( $content_post_id ) { |
|
594 | + $title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), '<a href="' . get_permalink( $content_post_id ) . '">' . get_the_title( $content_post_id ) . '</a>' ); |
|
595 | + } else { |
|
596 | + $title = get_the_title( $post->ID ); |
|
597 | + } |
|
598 | 598 | |
599 | - ?> |
|
599 | + ?> |
|
600 | 600 | <header> |
601 | 601 | |
602 | 602 | <h1> |
603 | 603 | |
604 | 604 | <?php |
605 | - /** |
|
606 | - * Filter Sensei single title |
|
607 | - * |
|
608 | - * @since 1.8.0 |
|
609 | - * @param string $title |
|
610 | - * @param string $template |
|
611 | - * @param string $post_type |
|
612 | - */ |
|
613 | - echo apply_filters( 'sensei_single_title', $title, $post->post_type ); |
|
614 | - ?> |
|
605 | + /** |
|
606 | + * Filter Sensei single title |
|
607 | + * |
|
608 | + * @since 1.8.0 |
|
609 | + * @param string $title |
|
610 | + * @param string $template |
|
611 | + * @param string $post_type |
|
612 | + */ |
|
613 | + echo apply_filters( 'sensei_single_title', $title, $post->post_type ); |
|
614 | + ?> |
|
615 | 615 | |
616 | 616 | </h1> |
617 | 617 | |
@@ -619,52 +619,52 @@ discard block |
||
619 | 619 | |
620 | 620 | <?php |
621 | 621 | |
622 | - } // End sensei_single_title() |
|
622 | + } // End sensei_single_title() |
|
623 | 623 | |
624 | - /** |
|
625 | - * Generates the my messages |
|
626 | - * archive header. |
|
627 | - * |
|
628 | - * @since 1.9.0 |
|
629 | - * |
|
630 | - * @return string |
|
631 | - */ |
|
632 | - public static function the_archive_header( ){ |
|
624 | + /** |
|
625 | + * Generates the my messages |
|
626 | + * archive header. |
|
627 | + * |
|
628 | + * @since 1.9.0 |
|
629 | + * |
|
630 | + * @return string |
|
631 | + */ |
|
632 | + public static function the_archive_header( ){ |
|
633 | 633 | |
634 | - $html = ''; |
|
635 | - $html .= '<header class="archive-header"><h1>'; |
|
636 | - $html .= __( 'My Messages', 'woothemes-sensei' ); |
|
637 | - $html .= '</h1></header>'; |
|
634 | + $html = ''; |
|
635 | + $html .= '<header class="archive-header"><h1>'; |
|
636 | + $html .= __( 'My Messages', 'woothemes-sensei' ); |
|
637 | + $html .= '</h1></header>'; |
|
638 | 638 | |
639 | - /** |
|
640 | - * Filter the sensei messages archive title. |
|
641 | - * @since 1.0.0 |
|
642 | - */ |
|
643 | - echo apply_filters( 'sensei_message_archive_title', $html ); |
|
639 | + /** |
|
640 | + * Filter the sensei messages archive title. |
|
641 | + * @since 1.0.0 |
|
642 | + */ |
|
643 | + echo apply_filters( 'sensei_message_archive_title', $html ); |
|
644 | 644 | |
645 | - } // get_archive_header() |
|
645 | + } // get_archive_header() |
|
646 | 646 | |
647 | - /** |
|
648 | - * Output the title for a message given the post_id. |
|
649 | - * |
|
650 | - * @since 1.9.0 |
|
651 | - * @param $post_id |
|
652 | - */ |
|
653 | - public static function the_message_title( $message_post_id ){ |
|
647 | + /** |
|
648 | + * Output the title for a message given the post_id. |
|
649 | + * |
|
650 | + * @since 1.9.0 |
|
651 | + * @param $post_id |
|
652 | + */ |
|
653 | + public static function the_message_title( $message_post_id ){ |
|
654 | 654 | |
655 | - $content_post_id = get_post_meta( $message_post_id, '_post', true ); |
|
655 | + $content_post_id = get_post_meta( $message_post_id, '_post', true ); |
|
656 | 656 | |
657 | - if( $content_post_id ) { |
|
657 | + if( $content_post_id ) { |
|
658 | 658 | |
659 | - $title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), get_the_title( $content_post_id ) ); |
|
659 | + $title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), get_the_title( $content_post_id ) ); |
|
660 | 660 | |
661 | - } else { |
|
661 | + } else { |
|
662 | 662 | |
663 | - $title = get_the_title( $message_post_id ); |
|
663 | + $title = get_the_title( $message_post_id ); |
|
664 | 664 | |
665 | - } |
|
665 | + } |
|
666 | 666 | |
667 | - ?> |
|
667 | + ?> |
|
668 | 668 | <h2> |
669 | 669 | <a href="<?php esc_url( get_permalink( $message_post_id ) );?>"> |
670 | 670 | <?php echo $title; ?> |
@@ -673,21 +673,21 @@ discard block |
||
673 | 673 | </h2> |
674 | 674 | |
675 | 675 | <?php |
676 | - } //end the_message_header |
|
676 | + } //end the_message_header |
|
677 | 677 | |
678 | - /** |
|
679 | - * Output the message sender given the post id. |
|
680 | - * |
|
681 | - * @param $message_post_id |
|
682 | - */ |
|
683 | - public static function the_message_sender( $message_post_id ){ |
|
678 | + /** |
|
679 | + * Output the message sender given the post id. |
|
680 | + * |
|
681 | + * @param $message_post_id |
|
682 | + */ |
|
683 | + public static function the_message_sender( $message_post_id ){ |
|
684 | 684 | |
685 | - $sender_username = get_post_meta( $message_post_id, '_sender', true ); |
|
686 | - $sender = get_user_by( 'login', $sender_username ); |
|
685 | + $sender_username = get_post_meta( $message_post_id, '_sender', true ); |
|
686 | + $sender = get_user_by( 'login', $sender_username ); |
|
687 | 687 | |
688 | - if( $sender_username && $sender instanceof WP_User ) { |
|
689 | - $sender_display_name = sprintf( __( 'Sent by %1$s on %2$s.', 'woothemes-sensei' ), $sender->display_name, get_the_date() ); |
|
690 | - ?> |
|
688 | + if( $sender_username && $sender instanceof WP_User ) { |
|
689 | + $sender_display_name = sprintf( __( 'Sent by %1$s on %2$s.', 'woothemes-sensei' ), $sender->display_name, get_the_date() ); |
|
690 | + ?> |
|
691 | 691 | <p class="message-meta"> |
692 | 692 | <small> |
693 | 693 | <em> <?php echo $sender_display_name; ?> </em> |
@@ -695,18 +695,18 @@ discard block |
||
695 | 695 | </p> |
696 | 696 | |
697 | 697 | <?php |
698 | - } // end if |
|
699 | - |
|
700 | - } // end the_message_archive_sender |
|
701 | - |
|
702 | - /** |
|
703 | - * Link to the users my messages page |
|
704 | - * |
|
705 | - * @since 1.9.0 |
|
706 | - */ |
|
707 | - public static function the_my_messages_link(){ |
|
708 | - if( ! Sensei()->settings->get('messages_disable') ) { |
|
709 | - ?> |
|
698 | + } // end if |
|
699 | + |
|
700 | + } // end the_message_archive_sender |
|
701 | + |
|
702 | + /** |
|
703 | + * Link to the users my messages page |
|
704 | + * |
|
705 | + * @since 1.9.0 |
|
706 | + */ |
|
707 | + public static function the_my_messages_link(){ |
|
708 | + if( ! Sensei()->settings->get('messages_disable') ) { |
|
709 | + ?> |
|
710 | 710 | <p class="my-messages-link-container"> |
711 | 711 | <a class="my-messages-link" href="<?php echo get_post_type_archive_link( 'sensei_message' ); ?>" |
712 | 712 | title="<?php _e( 'View & reply to private messages sent to your course & lesson teachers.', 'woothemes-sensei' ); ?>"> |
@@ -714,8 +714,8 @@ discard block |
||
714 | 714 | </a> |
715 | 715 | </p> |
716 | 716 | <?php |
717 | - } |
|
718 | - } |
|
717 | + } |
|
718 | + } |
|
719 | 719 | |
720 | 720 | } // End Class |
721 | 721 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | add_action( 'sensei_course_status_updated', array( $this, 'learner_completed_course' ), 10, 4 ); |
46 | 46 | add_action( 'sensei_course_status_updated', array( $this, 'teacher_completed_course' ), 10, 4 ); |
47 | 47 | add_action( 'sensei_user_course_start', array( $this, 'teacher_started_course' ), 10, 2 ); |
48 | - add_action( 'sensei_user_lesson_end', array( $this, 'teacher_completed_lesson' ), 10, 2 ); |
|
48 | + add_action( 'sensei_user_lesson_end', array( $this, 'teacher_completed_lesson' ), 10, 2 ); |
|
49 | 49 | add_action( 'sensei_user_quiz_submitted', array( $this, 'teacher_quiz_submitted' ), 10, 5 ); |
50 | 50 | add_action( 'sensei_new_private_message', array( $this, 'teacher_new_message' ), 10, 1 ); |
51 | 51 | add_action( 'sensei_private_message_reply', array( $this, 'new_message_reply' ), 10, 2 ); |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | $this->emails['learner-graded-quiz'] = include( 'emails/class-woothemes-sensei-email-learner-graded-quiz.php' ); |
63 | 63 | $this->emails['learner-completed-course'] = include( 'emails/class-woothemes-sensei-email-learner-completed-course.php' ); |
64 | 64 | $this->emails['teacher-completed-course'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-course.php' ); |
65 | - $this->emails['teacher-started-course'] = include( 'emails/class-woothemes-sensei-email-teacher-started-course.php' ); |
|
66 | - $this->emails['teacher-completed-lesson'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-lesson.php' ); |
|
67 | - $this->emails['teacher-quiz-submitted'] = include( 'emails/class-woothemes-sensei-email-teacher-quiz-submitted.php' ); |
|
65 | + $this->emails['teacher-started-course'] = include( 'emails/class-woothemes-sensei-email-teacher-started-course.php' ); |
|
66 | + $this->emails['teacher-completed-lesson'] = include( 'emails/class-woothemes-sensei-email-teacher-completed-lesson.php' ); |
|
67 | + $this->emails['teacher-quiz-submitted'] = include( 'emails/class-woothemes-sensei-email-teacher-quiz-submitted.php' ); |
|
68 | 68 | $this->emails['teacher-new-message'] = include( 'emails/class-woothemes-sensei-email-teacher-new-message.php' ); |
69 | 69 | $this->emails['new-message-reply'] = include( 'emails/class-woothemes-sensei-email-new-message-reply.php' ); |
70 | 70 | $this->emails = apply_filters( 'sensei_email_classes', $this->emails ); |
@@ -171,20 +171,20 @@ discard block |
||
171 | 171 | add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
172 | 172 | add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
173 | 173 | |
174 | - // Send |
|
175 | - $send_email = true; |
|
174 | + // Send |
|
175 | + $send_email = true; |
|
176 | 176 | |
177 | - /** |
|
178 | - * Filter Sensei's ability to send out emails. |
|
179 | - * |
|
180 | - * @since 1.8.0 |
|
181 | - * @param bool $send_email default true |
|
182 | - */ |
|
183 | - if( apply_filters('sensei_send_emails', $send_email,$to, $subject, $message ) ){ |
|
177 | + /** |
|
178 | + * Filter Sensei's ability to send out emails. |
|
179 | + * |
|
180 | + * @since 1.8.0 |
|
181 | + * @param bool $send_email default true |
|
182 | + */ |
|
183 | + if( apply_filters('sensei_send_emails', $send_email,$to, $subject, $message ) ){ |
|
184 | 184 | |
185 | - wp_mail( $to, $subject, $message, $headers, $attachments ); |
|
185 | + wp_mail( $to, $subject, $message, $headers, $attachments ); |
|
186 | 186 | |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | 189 | // Unhook filters |
190 | 190 | remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
@@ -326,44 +326,44 @@ discard block |
||
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
329 | - /** |
|
330 | - * teacher_completed_lesson() |
|
331 | - * |
|
332 | - * Send email to teacher on student completing lesson |
|
333 | - * |
|
334 | - * @access public |
|
335 | - * @return void |
|
336 | - * @since 1.9.0 |
|
337 | - */ |
|
338 | - function teacher_completed_lesson( $learner_id = 0, $lesson_id = 0 ) { |
|
339 | - |
|
340 | - |
|
341 | - $send = false; |
|
342 | - |
|
343 | - if( isset( Sensei()->settings->settings[ 'email_teachers' ] ) ) { |
|
344 | - if( in_array( 'teacher-completed-lesson', (array) Sensei()->settings->settings[ 'email_teachers' ]) ) { |
|
345 | - $send = true; |
|
346 | - } |
|
347 | - } else { |
|
348 | - $send = true; |
|
349 | - } |
|
350 | - |
|
351 | - if( $send ) { |
|
352 | - $email = $this->emails['teacher-completed-lesson']; |
|
353 | - $email->trigger( $learner_id, $lesson_id ); |
|
354 | - } |
|
355 | - } |
|
329 | + /** |
|
330 | + * teacher_completed_lesson() |
|
331 | + * |
|
332 | + * Send email to teacher on student completing lesson |
|
333 | + * |
|
334 | + * @access public |
|
335 | + * @return void |
|
336 | + * @since 1.9.0 |
|
337 | + */ |
|
338 | + function teacher_completed_lesson( $learner_id = 0, $lesson_id = 0 ) { |
|
339 | + |
|
340 | + |
|
341 | + $send = false; |
|
342 | + |
|
343 | + if( isset( Sensei()->settings->settings[ 'email_teachers' ] ) ) { |
|
344 | + if( in_array( 'teacher-completed-lesson', (array) Sensei()->settings->settings[ 'email_teachers' ]) ) { |
|
345 | + $send = true; |
|
346 | + } |
|
347 | + } else { |
|
348 | + $send = true; |
|
349 | + } |
|
350 | + |
|
351 | + if( $send ) { |
|
352 | + $email = $this->emails['teacher-completed-lesson']; |
|
353 | + $email->trigger( $learner_id, $lesson_id ); |
|
354 | + } |
|
355 | + } |
|
356 | 356 | |
357 | 357 | /** |
358 | 358 | * Send email to teacher on quiz submission |
359 | 359 | * |
360 | 360 | * |
361 | - * @param int $learner_id |
|
362 | - * @param int $quiz_id |
|
363 | - * @param int $grade |
|
364 | - * @param int $passmark |
|
365 | - * @param string $quiz_grade_type |
|
366 | - */ |
|
361 | + * @param int $learner_id |
|
362 | + * @param int $quiz_id |
|
363 | + * @param int $grade |
|
364 | + * @param int $passmark |
|
365 | + * @param string $quiz_grade_type |
|
366 | + */ |
|
367 | 367 | function teacher_quiz_submitted( $learner_id = 0, $quiz_id = 0, $grade = 0, $passmark = 0, $quiz_grade_type = 'manual' ) { |
368 | 368 | |
369 | 369 | $send = false; |
@@ -16,38 +16,38 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class WooThemes_Sensei_Email_New_Message_Reply { |
18 | 18 | |
19 | - /** |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - var $template; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var string |
|
26 | - */ |
|
19 | + /** |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + var $template; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var string |
|
26 | + */ |
|
27 | 27 | var $subject; |
28 | 28 | |
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - var $heading; |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + var $heading; |
|
33 | 33 | |
34 | - /** |
|
35 | - * @var string |
|
36 | - */ |
|
34 | + /** |
|
35 | + * @var string |
|
36 | + */ |
|
37 | 37 | var $recipient; |
38 | 38 | |
39 | 39 | var $original_sender; |
40 | 40 | var $original_receiver; |
41 | 41 | var $commenter; |
42 | 42 | |
43 | - /** |
|
44 | - * @var WP_Post |
|
45 | - */ |
|
43 | + /** |
|
44 | + * @var WP_Post |
|
45 | + */ |
|
46 | 46 | var $message; |
47 | 47 | |
48 | - /** |
|
49 | - * @var WP_Comment |
|
50 | - */ |
|
48 | + /** |
|
49 | + * @var WP_Comment |
|
50 | + */ |
|
51 | 51 | var $comment; |
52 | 52 | |
53 | 53 | /** |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * trigger function. |
66 | 66 | * |
67 | - * @param WP_Comment $comment |
|
68 | - * @param string $message |
|
69 | - * |
|
67 | + * @param WP_Comment $comment |
|
68 | + * @param string $message |
|
69 | + * |
|
70 | 70 | * @return void |
71 | 71 | */ |
72 | 72 | function trigger ( $comment, $message ) { |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | |
91 | 91 | $comment_link = get_comment_link( $comment ); |
92 | 92 | |
93 | - // setup the post type parameter |
|
94 | - $content_type = get_post_type( $content_id ); |
|
95 | - if( !$content_type ){ |
|
96 | - $content_type =''; |
|
97 | - } |
|
93 | + // setup the post type parameter |
|
94 | + $content_type = get_post_type( $content_id ); |
|
95 | + if( !$content_type ){ |
|
96 | + $content_type =''; |
|
97 | + } |
|
98 | 98 | |
99 | - // Construct data array |
|
100 | - $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
101 | - 'template' => $this->template, |
|
102 | - $content_type.'_id' => $content_id, |
|
99 | + // Construct data array |
|
100 | + $sensei_email_data = apply_filters( 'sensei_email_data', array( |
|
101 | + 'template' => $this->template, |
|
102 | + $content_type.'_id' => $content_id, |
|
103 | 103 | 'heading' => $this->heading, |
104 | 104 | 'commenter_name' => $this->commenter->display_name, |
105 | 105 | 'message' => $this->comment->comment_content, |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * trigger function. |
38 | 38 | * |
39 | 39 | * @access public |
40 | - * @param integer $message_id |
|
40 | + * @param integer $message_id |
|
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | function trigger( $message_id = 0 ) { |
@@ -55,16 +55,16 @@ discard block |
||
55 | 55 | $content_id = get_post_meta( $message_id, '_post', true ); |
56 | 56 | $content_title = get_the_title( $content_id ); |
57 | 57 | |
58 | - // setup the post type parameter |
|
59 | - $content_type = get_post_type( $content_id ); |
|
60 | - if( !$content_type ){ |
|
61 | - $content_type =''; |
|
62 | - } |
|
58 | + // setup the post type parameter |
|
59 | + $content_type = get_post_type( $content_id ); |
|
60 | + if( !$content_type ){ |
|
61 | + $content_type =''; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | // Construct data array |
65 | 65 | $sensei_email_data = apply_filters( 'sensei_email_data', array( |
66 | 66 | 'template' => $this->template, |
67 | - $content_type.'_id' => $content_id, |
|
67 | + $content_type.'_id' => $content_id, |
|
68 | 68 | 'heading' => $this->heading, |
69 | 69 | 'teacher_id' => $this->teacher->ID, |
70 | 70 | 'learner_id' => $this->learner->ID, |
@@ -36,11 +36,11 @@ |
||
36 | 36 | /** |
37 | 37 | * trigger function. |
38 | 38 | * |
39 | - * @param int $user_id |
|
40 | - * @param int $quiz_id |
|
41 | - * @param int $grade |
|
42 | - * @param int $passmark |
|
43 | - * |
|
39 | + * @param int $user_id |
|
40 | + * @param int $quiz_id |
|
41 | + * @param int $grade |
|
42 | + * @param int $passmark |
|
43 | + * |
|
44 | 44 | * @return void |
45 | 45 | */ |
46 | 46 | function trigger ( $user_id = 0, $quiz_id = 0, $grade = 0, $passmark = 0 ) { |
@@ -38,10 +38,10 @@ |
||
38 | 38 | * trigger function. |
39 | 39 | * |
40 | 40 | * @access public |
41 | - * |
|
42 | - * @param int $user_id |
|
43 | - * @param int $course_id |
|
44 | - * |
|
41 | + * |
|
42 | + * @param int $user_id |
|
43 | + * @param int $course_id |
|
44 | + * |
|
45 | 45 | * @return void |
46 | 46 | */ |
47 | 47 | function trigger( $user_id = 0, $course_id = 0 ) { |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
7 | 7 | |
8 | 8 | if ( class_exists( 'Teacher_New_Course_Assignment' ) ){ |
9 | - return; |
|
9 | + return; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
@@ -40,40 +40,40 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function __construct() { |
42 | 42 | |
43 | - $this->template = 'teacher-new-course-assignment'; |
|
43 | + $this->template = 'teacher-new-course-assignment'; |
|
44 | 44 | $this->subject = apply_filters( 'sensei_email_subject', sprintf( __( '[%1$s] You have been assigned to a course', 'woothemes-sensei' ), get_bloginfo( 'name' ) ), $this->template ); |
45 | 45 | $this->heading = apply_filters( 'sensei_email_heading', __( 'Course assigned to you', 'woothemes-sensei' ), $this->template ); |
46 | - return; |
|
46 | + return; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * trigger function. |
51 | 51 | * |
52 | 52 | * @access public |
53 | - * @param $teacher_id |
|
54 | - * @param $course_id |
|
53 | + * @param $teacher_id |
|
54 | + * @param $course_id |
|
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | function trigger( $teacher_id = 0, $course_id = 0 ) { |
58 | 58 | global $sensei_email_data; |
59 | 59 | |
60 | 60 | $this->teacher = new WP_User( $teacher_id ); |
61 | - $this->recipient = stripslashes( $this->teacher->user_email ); |
|
62 | - $this->subject = __( 'New course assigned to you', 'woothemes-sensei' ); |
|
61 | + $this->recipient = stripslashes( $this->teacher->user_email ); |
|
62 | + $this->subject = __( 'New course assigned to you', 'woothemes-sensei' ); |
|
63 | 63 | |
64 | - //course edit link |
|
65 | - $course_edit_link = admin_url('post.php?post=' . $course_id . '&action=edit' ); |
|
64 | + //course edit link |
|
65 | + $course_edit_link = admin_url('post.php?post=' . $course_id . '&action=edit' ); |
|
66 | 66 | |
67 | - // Course name |
|
68 | - $course = get_post( $course_id); |
|
67 | + // Course name |
|
68 | + $course = get_post( $course_id); |
|
69 | 69 | // Construct data array |
70 | 70 | $sensei_email_data = apply_filters( 'sensei_email_data', array( |
71 | 71 | 'template' => $this->template, |
72 | 72 | 'heading' => $this->heading, |
73 | 73 | 'teacher_id' => $teacher_id, |
74 | 74 | 'course_id' => $course_id, |
75 | - 'course_name' => $course->post_title, |
|
76 | - 'course_edit_link' => $course_edit_link, |
|
75 | + 'course_name' => $course->post_title, |
|
76 | + 'course_edit_link' => $course_edit_link, |
|
77 | 77 | ), $this->template ); |
78 | 78 | |
79 | 79 | // Send mail |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | |
35 | 35 | /** |
36 | 36 | * trigger function. |
37 | - * |
|
38 | - * @param integer $learner_id |
|
39 | - * @param integer $quiz_id |
|
40 | - * |
|
37 | + * |
|
38 | + * @param integer $learner_id |
|
39 | + * @param integer $quiz_id |
|
40 | + * |
|
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | function trigger( $learner_id = 0, $quiz_id = 0 ) { |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | $this->learner = new WP_User( $learner_id ); |
48 | 48 | |
49 | 49 | // Get teacher ID and user object |
50 | - $lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true ); |
|
51 | - $course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
50 | + $lesson_id = get_post_meta( $quiz_id, '_quiz_lesson', true ); |
|
51 | + $course_id = get_post_meta( $lesson_id, '_lesson_course', true ); |
|
52 | 52 | $teacher_id = get_post_field( 'post_author', $course_id, 'raw' ); |
53 | 53 | $this->teacher = new WP_User( $teacher_id ); |
54 | 54 |