← All changes
|
inc/emails/student/class-lp-email-enrolled-course-user.php
+12
-5
4.1.7
→
4.4.10
View file →
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @author ThimPress |
| 6 | 6 | * @package Learnpress/Classes |
| 7 | 7 | * @extends LP_Email |
| 8 | - * @version 3.0.0 | |
| 8 | + * @version 3.0.1 | |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Prevent loading this file directly |
| @@ -24,12 +24,12 @@ | ||
| 24 | 24 | */ |
| 25 | 25 | public function __construct() { |
| 26 | 26 | $this->id = 'enrolled-course-user'; |
| 27 | 27 | $this->title = __( 'User', 'learnpress' ); |
| 28 | - $this->description = __( 'Send this email to user when they have enrolled course.', 'learnpress' ); | |
| 28 | + $this->description = __( 'Send this email to the user when they have enrolled in the course.', 'learnpress' ); | |
| 29 | 29 | |
| 30 | - $this->default_subject = __( '[{{site_title}}] You have enrolled in course', 'learnpress' ); | |
| 31 | - $this->default_heading = __( 'You have enrolled course', 'learnpress' ); | |
| 30 | + $this->default_subject = __( '[{{site_title}}] You have enrolled in the course', 'learnpress' ); | |
| 31 | + $this->default_heading = __( 'You have enrolled in the course', 'learnpress' ); | |
| 32 | 32 | |
| 33 | 33 | parent::__construct(); |
| 34 | 34 | } |
| 35 | 35 | |
| @@ -47,10 +47,17 @@ | ||
| 47 | 47 | if ( ! $this->check_and_set( $params ) ) { |
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + $user_email = ''; | |
| 52 | + if ( $this->_user ) { | |
| 53 | + $user_email = $this->_user->get_email(); | |
| 54 | + } else { | |
| 55 | + $user_email = $this->_order->get_user_email(); | |
| 56 | + } | |
| 57 | + | |
| 51 | 58 | $this->set_data_content(); |
| 52 | - $this->set_receive( $this->_user->get_email() ); | |
| 59 | + $this->set_receive( $user_email ); | |
| 53 | 60 | $this->send_email(); |
| 54 | 61 | } |
| 55 | 62 | } |
| 56 | 63 | } |