Fix email templates.
This commit is contained in:
@@ -69,15 +69,16 @@ class OpalEstate_Abstract_Email_Template {
|
||||
public function replace_tags( $template ) {
|
||||
$args = $this->args;
|
||||
$default = [
|
||||
'receiver_name' => '',
|
||||
'name' => '',
|
||||
'receiver_email' => '',
|
||||
'property_link' => '',
|
||||
'message' => '',
|
||||
'site_name' => get_bloginfo(),
|
||||
'site_link' => get_home_url(),
|
||||
'current_time' => date( "F j, Y, g:i a" ),
|
||||
'phone' => '',
|
||||
'receiver_name' => '',
|
||||
'name' => '',
|
||||
'receiver_email' => '',
|
||||
'property_link' => '',
|
||||
'property_edit_link' => '',
|
||||
'message' => '',
|
||||
'site_name' => get_bloginfo(),
|
||||
'site_link' => get_home_url(),
|
||||
'current_time' => date( "F j, Y, g:i a" ),
|
||||
'phone' => '',
|
||||
];
|
||||
|
||||
$args = array_merge( $default, $args );
|
||||
|
||||
@@ -21,11 +21,10 @@ class OpalEstate_Send_Email_Admin_New_Submitted extends OpalEstate_Abstract_Emai
|
||||
* Send Email
|
||||
*/
|
||||
public function get_subject() {
|
||||
$propety_title = '';
|
||||
$d = esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' );
|
||||
$s = opalestate_get_option( 'admin_newproperty_email_subject', $d );
|
||||
$d = esc_html__( 'You received a new submission: {property_name} from {user_mail}', 'opalestate-pro' );
|
||||
$s = opalestate_get_option( 'admin_newproperty_email_subject', $d );
|
||||
|
||||
return $s;
|
||||
return $this->replace_tags( $s );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,19 +37,19 @@ class OpalEstate_Send_Email_Admin_New_Submitted extends OpalEstate_Abstract_Emai
|
||||
$email = $email ? $email : $user->data->user_email;
|
||||
|
||||
$this->args = [
|
||||
'receiver_email' => $email,
|
||||
'user_mail' => $email,
|
||||
'user_name' => $user->display_name,
|
||||
'submitted_date' => $property->post_date,
|
||||
'property_name' => $property->post_title,
|
||||
'property_link' => get_permalink( $property_id ),
|
||||
'current_time' => date( "F j, Y, g:i a" ),
|
||||
'receiver_email' => $email,
|
||||
'user_mail' => $email,
|
||||
'user_name' => $user->display_name,
|
||||
'submitted_date' => $property->post_date,
|
||||
'property_name' => $property->post_title,
|
||||
'property_link' => get_permalink( $property_id ),
|
||||
'property_edit_link' => get_edit_post_link( $property_id ),
|
||||
'current_time' => date( "F j, Y, g:i a" ),
|
||||
];
|
||||
|
||||
return $this->args;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
@@ -65,7 +64,7 @@ class OpalEstate_Send_Email_Admin_New_Submitted extends OpalEstate_Abstract_Emai
|
||||
*/
|
||||
public static function get_default_template() {
|
||||
return trim( preg_replace( '/\t+/', '', '
|
||||
You’ve received a submission from %s: {user_name},
|
||||
You’ve received a submission from: {user_name},
|
||||
<br>
|
||||
You can review it by follow this link: {property_edit_link}
|
||||
<em>This message was sent by {site_link} on {current_time}.</em>'
|
||||
@@ -76,7 +75,7 @@ class OpalEstate_Send_Email_Admin_New_Submitted extends OpalEstate_Abstract_Emai
|
||||
* Send Email
|
||||
*/
|
||||
public function to_email() {
|
||||
return $this->args ['receiver_email'];
|
||||
return $this->from_email();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* @website http://www.wpopal.com
|
||||
* @support http://www.wpopal.com/support/forum.html
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
@@ -22,57 +22,55 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
* @version 1.0
|
||||
*/
|
||||
class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function get_subject () {
|
||||
$propety_title = '' ;
|
||||
|
||||
$subject = sprintf( esc_html__( 'The Property Listing Approved: {property_name}', 'opalestate-pro' ), $propety_title );
|
||||
$subject = opalestate_options( 'approve_email_body' , $subject );
|
||||
|
||||
return $subject;
|
||||
/**
|
||||
* Get subject.
|
||||
*/
|
||||
public function get_subject() {
|
||||
$subject = esc_html__( 'The Property Listing Approved: {property_name}', 'opalestate-pro' );
|
||||
$subject = opalestate_options( 'approve_email_body', $subject );
|
||||
|
||||
return $this->replace_tags( $subject );
|
||||
}
|
||||
|
||||
/**
|
||||
* get collection of key and value base on tags which using to replace custom tags
|
||||
* Get collection of key and value base on tags which using to replace custom tags
|
||||
*/
|
||||
public function set_pros( $property_id ){
|
||||
|
||||
$property = get_post( $property_id );
|
||||
$user = get_userdata( $property->post_author );
|
||||
$email = get_user_meta( $property->post_author, OPALESTATE_USER_PROFILE_PREFIX . 'email', true );
|
||||
$email = $email ? $email : $user->data->user_email;
|
||||
public function set_pros( $property_id ) {
|
||||
$property = get_post( $property_id );
|
||||
$user = get_userdata( $property->post_author );
|
||||
$email = get_user_meta( $property->post_author, OPALESTATE_USER_PROFILE_PREFIX . 'email', true );
|
||||
$email = $email ? $email : $user->data->user_email;
|
||||
|
||||
$this->args = array(
|
||||
'receiver_email' => $email,
|
||||
'user_mail' => $email,
|
||||
'user_name' => $user->display_name,
|
||||
'submitted_date' => $property->post_date,
|
||||
'property_name' => $property->post_title,
|
||||
'property_link' => get_permalink( $property_id ),
|
||||
'current_time' => date("F j, Y, g:i a"),
|
||||
);
|
||||
$this->args = [
|
||||
'receiver_email' => $email,
|
||||
'user_mail' => $email,
|
||||
'user_name' => $user->display_name,
|
||||
'submitted_date' => $property->post_date,
|
||||
'property_name' => $property->post_title,
|
||||
'property_link' => get_permalink( $property_id ),
|
||||
'current_time' => date( "F j, Y, g:i a" ),
|
||||
];
|
||||
|
||||
return $this->args ;
|
||||
return $this->args;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function get_content_template() {
|
||||
|
||||
$content = opalestate_options( 'approve_email_body' , self::get_default_template() );
|
||||
return $content;
|
||||
}
|
||||
$content = opalestate_options( 'approve_email_body', self::get_default_template() );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static function get_default_template() {
|
||||
|
||||
return trim(preg_replace('/\t+/', '', "Hi {user_name},<br>
|
||||
|
||||
return trim( preg_replace( '/\t+/', '', "Hi {user_name},<br>
|
||||
<br>
|
||||
Thank you so much for submitting to {site_name}.
|
||||
<br>
|
||||
@@ -83,34 +81,35 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<em>This message was sent by {site_link} on {current_time}.</em>"));
|
||||
<em>This message was sent by {site_link} on {current_time}.</em>" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function to_email () {
|
||||
public function to_email() {
|
||||
return $this->args ['receiver_email'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function cc_email () {
|
||||
public function cc_email() {
|
||||
return $this->args ['sender_email'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function get_body() {
|
||||
|
||||
$post = get_post( $this->args['post_id'] );
|
||||
|
||||
$this->args['email'] = $this->args['receiver_email'];
|
||||
$this->args['property_link'] = $post->post_title;
|
||||
|
||||
$post = get_post( $this->args['post_id'] );
|
||||
|
||||
$this->args['email'] = $this->args['receiver_email'];
|
||||
$this->args['property_link'] = $post->post_title;
|
||||
|
||||
return parent::get_body();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
?>
|
||||
|
||||
@@ -18,38 +18,36 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
||||
/**
|
||||
* @class OpalEstate_Send_Email_Notification
|
||||
*
|
||||
* @version 1.0
|
||||
*/
|
||||
class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Template {
|
||||
|
||||
public $type = '';
|
||||
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function get_subject () {
|
||||
public function get_subject() {
|
||||
switch ( $this->type ) {
|
||||
case 'enquiry':
|
||||
|
||||
$subject = html_entity_decode( esc_html__('You got a message enquiry', 'opalestate-pro') );
|
||||
$subject = html_entity_decode( esc_html__( 'You got a message enquiry', 'opalestate-pro' ) );
|
||||
$subject = opalestate_options( 'enquiry_email_subject', $subject );
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
$subject = html_entity_decode( esc_html__('You got a message contact', 'opalestate-pro') );
|
||||
$subject = html_entity_decode( esc_html__( 'You got a message contact', 'opalestate-pro' ) );
|
||||
$subject = opalestate_options( 'contact_email_subject', $subject );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return $subject;
|
||||
return $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
* Send Email.
|
||||
*/
|
||||
public function get_content_template() {
|
||||
switch ( $this->type ) {
|
||||
@@ -57,32 +55,36 @@ class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Templ
|
||||
return opalestate_options( 'enquiry_email_body', self::get_default_template( 'enquiry' ) );
|
||||
break;
|
||||
default:
|
||||
return opalestate_options( 'contact_email_body', self::get_default_template( ) );
|
||||
return opalestate_options( 'contact_email_body', self::get_default_template() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function to_email () {
|
||||
public function to_email() {
|
||||
return $this->args ['receiver_email'];
|
||||
}
|
||||
|
||||
public function cc_email () {
|
||||
public function cc_email() {
|
||||
return $this->args ['sender_email'];
|
||||
}
|
||||
|
||||
public function get_body() {
|
||||
$this->args['email'] = $this->args['receiver_email'];
|
||||
$this->args['email'] = $this->args['sender_email'];
|
||||
|
||||
return parent::get_body();
|
||||
}
|
||||
|
||||
/***/
|
||||
public static function get_default_template ( $type='contact' ) {
|
||||
|
||||
if( $type == 'enquiry' ) {
|
||||
/**
|
||||
* Get default template.
|
||||
*
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
public static function get_default_template( $type = 'contact' ) {
|
||||
if ( $type == 'enquiry' ) {
|
||||
return opalestate_load_template_path( 'emails/enquiry' );
|
||||
}
|
||||
|
||||
return opalestate_load_template_path( 'emails/contact' );
|
||||
return opalestate_load_template_path( 'emails/contact' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -11,7 +11,7 @@
|
||||
* @website http://www.wpopal.com
|
||||
* @support http://www.wpopal.com/support/forum.html
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
@@ -19,41 +19,39 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
/**
|
||||
* @class OpalEstate_Send_Email_Notification
|
||||
*
|
||||
* @version 1.0
|
||||
*/
|
||||
class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Template {
|
||||
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function get_subject () {
|
||||
$propety_title = '' ;
|
||||
$d = esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' );
|
||||
$s = opalestate_get_option( 'newproperty_email_subject' , $d );
|
||||
return $s;
|
||||
public function get_subject() {
|
||||
$d = esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' );
|
||||
$s = opalestate_get_option( 'newproperty_email_subject', $d );
|
||||
|
||||
return $this->replace_tags( $s );
|
||||
}
|
||||
|
||||
/**
|
||||
* get collection of key and value base on tags which using to replace custom tags
|
||||
*/
|
||||
public function set_pros( $property_id, $user_id ){
|
||||
|
||||
$property = get_post( $property_id );
|
||||
$user = get_userdata( $property->post_author );
|
||||
$email = get_user_meta( $property->post_author, OPALESTATE_USER_PROFILE_PREFIX . 'email', true );
|
||||
$email = $email ? $email : $user->data->user_email;
|
||||
public function set_pros( $property_id, $user_id ) {
|
||||
$property = get_post( $property_id );
|
||||
$user = get_userdata( $property->post_author );
|
||||
$email = get_user_meta( $property->post_author, OPALESTATE_USER_PROFILE_PREFIX . 'email', true );
|
||||
$email = $email ? $email : $user->data->user_email;
|
||||
|
||||
$this->args = array(
|
||||
'receiver_email' => $email,
|
||||
'user_mail' => $email,
|
||||
'user_name' => $user->display_name,
|
||||
'submitted_date' => $property->post_date,
|
||||
'property_name' => $property->post_title,
|
||||
'property_link' => get_permalink( $property_id ),
|
||||
'current_time' => date("F j, Y, g:i a"),
|
||||
);
|
||||
$this->args = [
|
||||
'receiver_email' => $email,
|
||||
'user_mail' => $email,
|
||||
'user_name' => $user->display_name,
|
||||
'submitted_date' => $property->post_date,
|
||||
'property_name' => $property->post_title,
|
||||
'property_link' => get_permalink( $property_id ),
|
||||
'current_time' => date( "F j, Y, g:i a" ),
|
||||
];
|
||||
|
||||
return $this->args ;
|
||||
return $this->args;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,16 +60,17 @@ class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Temp
|
||||
*/
|
||||
public function get_content_template() {
|
||||
|
||||
$body = opalestate_get_option( 'newproperty_email_body', self::get_default_template() );
|
||||
return $body;
|
||||
}
|
||||
$body = opalestate_get_option( 'newproperty_email_body', self::get_default_template() );
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public static function get_default_template() {
|
||||
|
||||
return trim(preg_replace('/\t+/', '','
|
||||
|
||||
return trim( preg_replace( '/\t+/', '', '
|
||||
Hi {user_name},
|
||||
<br>
|
||||
Thanks you so much for submitting {property_name} at {site_name}:<br>
|
||||
@@ -87,14 +86,14 @@ class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Temp
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function to_email () {
|
||||
public function to_email() {
|
||||
return $this->args ['receiver_email'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function cc_email () {
|
||||
public function cc_email() {
|
||||
return $this->args ['sender_email'];
|
||||
}
|
||||
|
||||
@@ -105,4 +104,3 @@ class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Temp
|
||||
return parent::get_body();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -27,9 +27,7 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
|
||||
* Send Email
|
||||
*/
|
||||
public function get_subject() {
|
||||
$propety_title = '';
|
||||
|
||||
$content = sprintf( esc_html__( 'You have a message request reviewing: %s at', 'opalestate-pro' ), $propety_title );
|
||||
$content = esc_html__( 'You have a message request reviewing', 'opalestate-pro' );
|
||||
$content = opalestate_options( 'request_review_email_subject', $content );
|
||||
|
||||
return $content;
|
||||
@@ -40,6 +38,7 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
|
||||
*/
|
||||
public function get_content_template() {
|
||||
$content = opalestate_options( 'request_review_email_body', self::get_default_template() );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
@@ -63,7 +62,7 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
|
||||
public function get_body() {
|
||||
$post = get_post( $this->args['post_id'] );
|
||||
|
||||
$this->args['email'] = $this->args['receiver_email'];
|
||||
// $this->args['email'] = $this->args['receiver_email'];
|
||||
$this->args['property_link'] = get_permalink( $post->ID );
|
||||
$this->args['property_name'] = $post->post_title;
|
||||
|
||||
@@ -73,5 +72,4 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
|
||||
public static function get_default_template() {
|
||||
return opalestate_load_template_path( 'emails/request-reviewing' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user