Update email.
This commit is contained in:
parent
7fe9e71ec0
commit
76dcd7ae25
@ -120,6 +120,7 @@ window.opalestate_messages = function() {
|
|||||||
function make_ajax ( data, _this ) {
|
function make_ajax ( data, _this ) {
|
||||||
$( '.opalestate-message-notify', _this ).remove();
|
$( '.opalestate-message-notify', _this ).remove();
|
||||||
var action = $( _this ).data('action')? $( _this ).data('action') : 'send_email_contact';
|
var action = $( _this ).data('action')? $( _this ).data('action') : 'send_email_contact';
|
||||||
|
console.log(action)
|
||||||
toggle_submit_button( _this );
|
toggle_submit_button( _this );
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type : 'POST',
|
||||||
@ -135,6 +136,9 @@ window.opalestate_messages = function() {
|
|||||||
}
|
}
|
||||||
toggle_submit_button( _this );
|
toggle_submit_button( _this );
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
error: function( response ) {
|
||||||
|
console.log(response)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Exit if accessed directly
|
// Exit if accessed directly
|
||||||
if ( !defined( 'ABSPATH' ) ) exit;
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class OpalMembership_Checkout
|
* @class OpalMembership_Checkout
|
||||||
@ -30,26 +32,26 @@ class Opalestate_Emails {
|
|||||||
|
|
||||||
self::load();
|
self::load();
|
||||||
|
|
||||||
add_action( 'opalestate_processed_new_submission' , array( __CLASS__ , 'new_submission_email'), 10, 2 );
|
add_action( 'opalestate_processed_new_submission', [ __CLASS__, 'new_submission_email' ], 10, 2 );
|
||||||
//add_action( 'opalestate_processed_edit_submission' , array( __CLASS__ , 'new_submission_email'), 10, 2 );
|
//add_action( 'opalestate_processed_edit_submission' , array( __CLASS__ , 'new_submission_email'), 10, 2 );
|
||||||
if ( is_admin() ) {
|
if ( is_admin() ) {
|
||||||
add_filter( 'opalestate_settings_tabs', array( __CLASS__, 'setting_email_tab'), 1 );
|
add_filter( 'opalestate_settings_tabs', [ __CLASS__, 'setting_email_tab' ], 1 );
|
||||||
add_filter( 'opalestate_registered_emails_settings', array( __CLASS__, 'setting_email_fields'), 10, 1 );
|
add_filter( 'opalestate_registered_emails_settings', [ __CLASS__, 'setting_email_fields' ], 10, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
$enable_approve_property_email = opalestate_get_option( 'enable_approve_property_email' );
|
$enable_approve_property_email = opalestate_get_option( 'enable_approve_property_email' );
|
||||||
|
|
||||||
if ( $enable_approve_property_email == 'on' ) {
|
if ( $enable_approve_property_email == 'on' ) {
|
||||||
add_action( 'transition_post_status', array( __CLASS__, 'send_email_when_publish_property') , 10, 3 );
|
add_action( 'transition_post_status', [ __CLASS__, 'send_email_when_publish_property' ], 10, 3 );
|
||||||
add_action( 'opalestate_processed_approve_publish_property', array( __CLASS__, 'approve_publish_property_email') , 10, 1 );
|
add_action( 'opalestate_processed_approve_publish_property', [ __CLASS__, 'approve_publish_property_email' ], 10, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send email when User contact via Enquiry Form and Contact Form
|
* Send email when User contact via Enquiry Form and Contact Form
|
||||||
*/
|
*/
|
||||||
add_action( 'opalestate_send_email_notifycation', array(__CLASS__,'send_notifycation') );
|
add_action( 'opalestate_send_email_notifycation', [ __CLASS__, 'send_notifycation' ] );
|
||||||
add_action( 'opalestate_send_email_submitted', array(__CLASS__,'new_submission_email') );
|
add_action( 'opalestate_send_email_submitted', [ __CLASS__, 'new_submission_email' ] );
|
||||||
add_action( 'opalestate_send_email_request_reviewing', array( __CLASS__, 'send_email_request_reviewing') );
|
add_action( 'opalestate_send_email_request_reviewing', [ __CLASS__, 'send_email_request_reviewing' ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +70,6 @@ class Opalestate_Emails {
|
|||||||
* Send Email Notifycation with two types: Enquiry or Contact
|
* Send Email Notifycation with two types: Enquiry or Contact
|
||||||
*/
|
*/
|
||||||
public static function send_notifycation( $content ) {
|
public static function send_notifycation( $content ) {
|
||||||
|
|
||||||
$mail = new OpalEstate_Send_Email_Notification();
|
$mail = new OpalEstate_Send_Email_Notification();
|
||||||
$mail->set_args( $content );
|
$mail->set_args( $content );
|
||||||
|
|
||||||
@ -77,24 +78,22 @@ class Opalestate_Emails {
|
|||||||
if ( isset( $content['data'] ) ) {
|
if ( isset( $content['data'] ) ) {
|
||||||
$return['data'] = $content['data'];
|
$return['data'] = $content['data'];
|
||||||
}
|
}
|
||||||
echo json_encode( $return ); die();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
echo json_encode( $return );
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send email if agent submit a new property
|
* send email if agent submit a new property
|
||||||
*/
|
*/
|
||||||
public static function new_submission_email( $user_id, $post_id ) {
|
public static function new_submission_email( $user_id, $post_id ) {
|
||||||
|
|
||||||
$mail = new OpalEstate_Send_Email_New_Submitted();
|
$mail = new OpalEstate_Send_Email_New_Submitted();
|
||||||
|
|
||||||
$mail->set_pros( $post_id, $user_id );
|
$mail->set_pros( $post_id, $user_id );
|
||||||
|
|
||||||
$return = self::send_mail_now( $mail );
|
$return = self::send_mail_now( $mail );
|
||||||
|
|
||||||
|
echo json_encode( $return );
|
||||||
echo json_encode( $return ); die();
|
die();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,22 +101,19 @@ class Opalestate_Emails {
|
|||||||
* Send email to requet viewing a property
|
* Send email to requet viewing a property
|
||||||
*/
|
*/
|
||||||
public static function send_email_request_reviewing( $content ) {
|
public static function send_email_request_reviewing( $content ) {
|
||||||
|
|
||||||
$mail = new OpalEstate_Send_Email_Request_Reviewing();
|
$mail = new OpalEstate_Send_Email_Request_Reviewing();
|
||||||
$mail->set_args( $content );
|
$mail->set_args( $content );
|
||||||
|
|
||||||
$return = self::send_mail_now( $mail );
|
$return = self::send_mail_now( $mail );
|
||||||
|
|
||||||
|
echo json_encode( $return );
|
||||||
echo json_encode( $return ); die();
|
die();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function send_mail_now( $mail ) {
|
public static function send_mail_now( $mail ) {
|
||||||
|
|
||||||
$from_name = $mail->from_name();
|
$from_name = $mail->from_name();
|
||||||
$from_email = $mail->from_email();
|
$from_email = $mail->from_email();
|
||||||
$headers = sprintf( "From: %s <%s>\r\n Content-type: text/html", $from_name, $from_email );
|
$headers = sprintf( "From: %s <%s>\r\n Content-type: text/html", $from_name, $from_email );
|
||||||
@ -132,13 +128,15 @@ class Opalestate_Emails {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$status = @wp_mail( $mail->to_email(), $subject, $message, $headers );
|
$status = @wp_mail( $mail->to_email(), $subject, $message, $headers );
|
||||||
$return = array( 'status' => true, 'msg' => esc_html__( 'Message has been successfully sent.', 'opalestate-pro' ) );
|
|
||||||
|
|
||||||
|
if ( $status ) {
|
||||||
|
return [ 'status' => true, 'msg' => esc_html__( 'Message has been successfully sent.', 'opalestate-pro' ) ];
|
||||||
} else {
|
} else {
|
||||||
$return = array( 'status' => true, 'msg' => esc_html__( 'Message has been successfully sent.', 'opalestate-pro' ) );
|
return [ 'status' => true, 'msg' => esc_html__( 'Unable to send a message.', 'opalestate-pro' ) ];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return [ 'status' => true, 'msg' => esc_html__( 'Missing some information!', 'opalestate-pro' ) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,6 +166,7 @@ class Opalestate_Emails {
|
|||||||
public static function setting_email_tab( $tabs ) {
|
public static function setting_email_tab( $tabs ) {
|
||||||
|
|
||||||
$tabs['emails'] = esc_html__( 'Email', 'opalestate-pro' );
|
$tabs['emails'] = esc_html__( 'Email', 'opalestate-pro' );
|
||||||
|
|
||||||
return $tabs;
|
return $tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,131 +252,131 @@ class Opalestate_Emails {
|
|||||||
$list_tags = apply_filters( 'opalestate_email_tags', $list_tags );
|
$list_tags = apply_filters( 'opalestate_email_tags', $list_tags );
|
||||||
|
|
||||||
|
|
||||||
$fields = array(
|
$fields = [
|
||||||
'id' => 'options_page',
|
'id' => 'options_page',
|
||||||
'title' => esc_html__( 'Email Settings', 'opalestate-pro' ),
|
'title' => esc_html__( 'Email Settings', 'opalestate-pro' ),
|
||||||
'show_on' => array( 'key' => 'options-page', 'value' => array( 'opalestate_settings' ), ),
|
'show_on' => [ 'key' => 'options-page', 'value' => [ 'opalestate_settings' ], ],
|
||||||
'fields' => apply_filters( 'opalestate_settings_emails', array(
|
'fields' => apply_filters( 'opalestate_settings_emails', [
|
||||||
array(
|
[
|
||||||
'name' => esc_html__( 'Email Settings', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Settings', 'opalestate-pro' ),
|
||||||
'desc' => '<hr>',
|
'desc' => '<hr>',
|
||||||
'id' => 'opalestate_title_email_settings_1',
|
'id' => 'opalestate_title_email_settings_1',
|
||||||
'type' => 'title'
|
'type' => 'title',
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'id' => 'from_name',
|
'id' => 'from_name',
|
||||||
'name' => esc_html__( 'From Name', 'opalestate-pro' ),
|
'name' => esc_html__( 'From Name', 'opalestate-pro' ),
|
||||||
'desc' => esc_html__( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'opalestate-pro' ),
|
'desc' => esc_html__( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'opalestate-pro' ),
|
||||||
'default' => get_bloginfo( 'name' ),
|
'default' => get_bloginfo( 'name' ),
|
||||||
'type' => 'text'
|
'type' => 'text',
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'id' => 'from_email',
|
'id' => 'from_email',
|
||||||
'name' => esc_html__( 'From Email', 'opalestate-pro' ),
|
'name' => esc_html__( 'From Email', 'opalestate-pro' ),
|
||||||
'desc' => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'opalestate-pro' ),
|
'desc' => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'opalestate-pro' ),
|
||||||
'default' => get_bloginfo( 'admin_email' ),
|
'default' => get_bloginfo( 'admin_email' ),
|
||||||
'type' => 'text'
|
'type' => 'text',
|
||||||
),
|
],
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
array(
|
|
||||||
'name' => esc_html__( 'Email Submission Templates (Template Tags)', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Submission Templates (Template Tags)', 'opalestate-pro' ),
|
||||||
'desc' => $list_tags . '<br><hr>',
|
'desc' => $list_tags . '<br><hr>',
|
||||||
'id' => 'opalestate_title_email_settings_2',
|
'id' => 'opalestate_title_email_settings_2',
|
||||||
'type' => 'title'
|
'type' => 'title',
|
||||||
),
|
],
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
array(
|
|
||||||
'name' => esc_html__( 'Notification For New Property Submission', 'opalestate-pro' ),
|
'name' => esc_html__( 'Notification For New Property Submission', 'opalestate-pro' ),
|
||||||
'desc' => '<hr>',
|
'desc' => '<hr>',
|
||||||
'id' => 'opalestate_title_email_settings_3',
|
'id' => 'opalestate_title_email_settings_3',
|
||||||
'type' => 'title'
|
'type' => 'title',
|
||||||
),
|
],
|
||||||
|
|
||||||
|
|
||||||
array(
|
[
|
||||||
'id' => 'newproperty_email_subject',
|
'id' => 'newproperty_email_subject',
|
||||||
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'desc' => esc_html__( 'The email subject for admin notifications.', 'opalestate-pro' ),
|
'desc' => esc_html__( 'The email subject for admin notifications.', 'opalestate-pro' ),
|
||||||
'attributes' => array(
|
'attributes' => [
|
||||||
'placeholder' => 'Your package is expired',
|
'placeholder' => 'Your package is expired',
|
||||||
'rows' => 3,
|
'rows' => 3,
|
||||||
),
|
],
|
||||||
'default' => esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' )
|
'default' => esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' ),
|
||||||
|
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
'id' => 'newproperty_email_body',
|
'id' => 'newproperty_email_body',
|
||||||
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
||||||
'type' => 'wysiwyg',
|
'type' => 'wysiwyg',
|
||||||
'desc' => esc_html__( 'Enter the email an admin should receive when an initial payment request is made.', 'opalestate-pro' ),
|
'desc' => esc_html__( 'Enter the email an admin should receive when an initial payment request is made.', 'opalestate-pro' ),
|
||||||
'default' => OpalEstate_Send_Email_New_Submitted::get_default_template(),
|
'default' => OpalEstate_Send_Email_New_Submitted::get_default_template(),
|
||||||
),
|
],
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
array(
|
[
|
||||||
'name' => esc_html__( 'Approve property for publish', 'opalestate-pro' ),
|
'name' => esc_html__( 'Approve property for publish', 'opalestate-pro' ),
|
||||||
'desc' => '<hr>',
|
'desc' => '<hr>',
|
||||||
'id' => 'opalestate_title_email_settings_4',
|
'id' => 'opalestate_title_email_settings_4',
|
||||||
'type' => 'title'
|
'type' => 'title',
|
||||||
),
|
],
|
||||||
|
|
||||||
array(
|
[
|
||||||
'name' => esc_html__( 'Enable approve property email', 'opalestate-pro' ),
|
'name' => esc_html__( 'Enable approve property email', 'opalestate-pro' ),
|
||||||
'desc' => esc_html__( 'Enable approve property email.', 'opalestate-pro' ),
|
'desc' => esc_html__( 'Enable approve property email.', 'opalestate-pro' ),
|
||||||
'id' => 'enable_approve_property_email',
|
'id' => 'enable_approve_property_email',
|
||||||
'type' => 'switch',
|
'type' => 'switch',
|
||||||
'options' => array(
|
'options' => [
|
||||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||||
),
|
],
|
||||||
'default' => 'off',
|
'default' => 'off',
|
||||||
),
|
],
|
||||||
|
|
||||||
array(
|
[
|
||||||
'id' => 'approve_email_subject',
|
'id' => 'approve_email_subject',
|
||||||
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'desc' => esc_html__( 'The email subject a user should receive when they make an initial property request.', 'opalestate-pro' ),
|
'desc' => esc_html__( 'The email subject a user should receive when they make an initial property request.', 'opalestate-pro' ),
|
||||||
'attributes' => array(
|
'attributes' => [
|
||||||
'placeholder' => 'Your property at I Love WordPress is pending',get_bloginfo( 'name' ),
|
'placeholder' => 'Your property at I Love WordPress is pending',
|
||||||
|
get_bloginfo( 'name' ),
|
||||||
'rows' => 3,
|
'rows' => 3,
|
||||||
),
|
],
|
||||||
'default' => esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' )
|
'default' => esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' ),
|
||||||
),
|
],
|
||||||
|
|
||||||
array(
|
[
|
||||||
'id' => 'approve_email_body',
|
'id' => 'approve_email_body',
|
||||||
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
||||||
'type' => 'wysiwyg',
|
'type' => 'wysiwyg',
|
||||||
'desc' => esc_html__( 'Enter the email a user should receive when they make an initial payment request.', 'opalestate-pro' ),
|
'desc' => esc_html__( 'Enter the email a user should receive when they make an initial payment request.', 'opalestate-pro' ),
|
||||||
'default' => OpalEstate_Send_Email_Approve::get_default_template(),
|
'default' => OpalEstate_Send_Email_Approve::get_default_template(),
|
||||||
),
|
],
|
||||||
|
|
||||||
/// email contact template ////
|
/// email contact template ////
|
||||||
array(
|
[
|
||||||
'name' => esc_html__( 'Email Contact Templates (Template Tags)', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Contact Templates (Template Tags)', 'opalestate-pro' ),
|
||||||
'desc' => $contact_list_tags . '<br><hr>',
|
'desc' => $contact_list_tags . '<br><hr>',
|
||||||
'id' => 'opalestate_title_email_settings_6',
|
'id' => 'opalestate_title_email_settings_6',
|
||||||
'type' => 'title'
|
'type' => 'title',
|
||||||
),
|
],
|
||||||
|
|
||||||
array(
|
[
|
||||||
'id' => 'contact_email_subject',
|
'id' => 'contact_email_subject',
|
||||||
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'desc' => esc_html__( 'The email subject a user should receive when they make an initial property request.', 'opalestate-pro' ),
|
'desc' => esc_html__( 'The email subject a user should receive when they make an initial property request.', 'opalestate-pro' ),
|
||||||
'attributes' => array(
|
'attributes' => [
|
||||||
'placeholder' => 'Your property at I Love WordPress is pending',get_bloginfo( 'name' ),
|
'placeholder' => 'Your property at I Love WordPress is pending',
|
||||||
|
get_bloginfo( 'name' ),
|
||||||
'rows' => 3,
|
'rows' => 3,
|
||||||
),
|
],
|
||||||
'default' => esc_html__('You got a message', 'opalestate-pro')
|
'default' => esc_html__( 'You got a message', 'opalestate-pro' ),
|
||||||
),
|
],
|
||||||
|
|
||||||
array(
|
[
|
||||||
'id' => 'contact_email_body',
|
'id' => 'contact_email_body',
|
||||||
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
||||||
'type' => 'wysiwyg',
|
'type' => 'wysiwyg',
|
||||||
@ -389,11 +388,11 @@ class Opalestate_Emails {
|
|||||||
<br>
|
<br>
|
||||||
<br>
|
<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>" ) ),
|
||||||
)
|
],
|
||||||
)
|
]
|
||||||
)
|
),
|
||||||
);
|
];
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
@ -401,12 +400,12 @@ class Opalestate_Emails {
|
|||||||
/**
|
/**
|
||||||
* get data of newrequest email
|
* get data of newrequest email
|
||||||
*
|
*
|
||||||
* @var $args array: property_id , $body
|
|
||||||
* @return text: message
|
* @return text: message
|
||||||
|
* @var $args array: property_id , $body
|
||||||
*/
|
*/
|
||||||
public static function replace_shortcode( $args, $body ) {
|
public static function replace_shortcode( $args, $body ) {
|
||||||
|
|
||||||
$tags = array(
|
$tags = [
|
||||||
'user_name' => "",
|
'user_name' => "",
|
||||||
'user_mail' => "",
|
'user_mail' => "",
|
||||||
'submitted_date' => "",
|
'submitted_date' => "",
|
||||||
@ -414,29 +413,32 @@ class Opalestate_Emails {
|
|||||||
'site_name' => '',
|
'site_name' => '',
|
||||||
'site_link' => '',
|
'site_link' => '',
|
||||||
'property_link' => '',
|
'property_link' => '',
|
||||||
);
|
];
|
||||||
$tags = array_merge( $tags, $args );
|
$tags = array_merge( $tags, $args );
|
||||||
|
|
||||||
extract( $tags );
|
extract( $tags );
|
||||||
|
|
||||||
$tags = array( "{user_mail}",
|
$tags = [
|
||||||
|
"{user_mail}",
|
||||||
"{user_name}",
|
"{user_name}",
|
||||||
"{submitted_date}",
|
"{submitted_date}",
|
||||||
"{site_name}",
|
"{site_name}",
|
||||||
"{site_link}",
|
"{site_link}",
|
||||||
"{current_time}",
|
"{current_time}",
|
||||||
'{property_name}',
|
'{property_name}',
|
||||||
'{property_link}');
|
'{property_link}',
|
||||||
|
];
|
||||||
|
|
||||||
$values = array( $user_mail,
|
$values = [
|
||||||
|
$user_mail,
|
||||||
$user_name,
|
$user_name,
|
||||||
$submitted_date,
|
$submitted_date,
|
||||||
get_bloginfo( 'name' ),
|
get_bloginfo( 'name' ),
|
||||||
get_home_url(),
|
get_home_url(),
|
||||||
date( "F j, Y, g:i a" ),
|
date( "F j, Y, g:i a" ),
|
||||||
$property_name,
|
$property_name,
|
||||||
$property_link
|
$property_link,
|
||||||
);
|
];
|
||||||
|
|
||||||
$message = str_replace( $tags, $values, $body );
|
$message = str_replace( $tags, $values, $body );
|
||||||
|
|
||||||
@ -450,7 +452,8 @@ class Opalestate_Emails {
|
|||||||
|
|
||||||
$return = self::send_mail_now( $mail );
|
$return = self::send_mail_now( $mail );
|
||||||
|
|
||||||
echo json_encode( $return ); die();
|
echo json_encode( $return );
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
*/
|
*/
|
||||||
class OpalEstate_Abstract_Email_Template {
|
class OpalEstate_Abstract_Email_Template {
|
||||||
|
|
||||||
public $args = array();
|
public $args = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the unique email notification key.
|
* Get the unique email notification key.
|
||||||
@ -67,24 +67,23 @@ class OpalEstate_Abstract_Email_Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function replace_tags( $template ) {
|
public function replace_tags( $template ) {
|
||||||
|
|
||||||
$args = $this->args;
|
$args = $this->args;
|
||||||
$default = array(
|
$default = [
|
||||||
'receiver_name' => '',
|
'receiver_name' => '',
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'receiver_email' => '',
|
'receiver_email' => '',
|
||||||
'property_link' => '',
|
'property_link' => '',
|
||||||
'message' => '',
|
'message' => '',
|
||||||
'site_name' => bloginfo(),
|
'site_name' => get_bloginfo(),
|
||||||
'site_link' => get_home_url(),
|
'site_link' => get_home_url(),
|
||||||
'current_time' => date( "F j, Y, g:i a" ),
|
'current_time' => date( "F j, Y, g:i a" ),
|
||||||
'phone' => ''
|
'phone' => '',
|
||||||
);
|
];
|
||||||
|
|
||||||
$args = array_merge( $default, $args );
|
$args = array_merge( $default, $args );
|
||||||
|
|
||||||
$tags = array();
|
$tags = [];
|
||||||
$values = array() ;
|
$values = [];
|
||||||
|
|
||||||
foreach ( $args as $key => $value ) {
|
foreach ( $args as $key => $value ) {
|
||||||
$tags[] = "{" . $key . "}";
|
$tags[] = "{" . $key . "}";
|
||||||
@ -114,8 +113,8 @@ class OpalEstate_Abstract_Email_Template {
|
|||||||
|
|
||||||
|
|
||||||
public function get_body() {
|
public function get_body() {
|
||||||
|
|
||||||
$template = $this->get_content_template();
|
$template = $this->get_content_template();
|
||||||
|
|
||||||
return $this->replace_tags( $template );
|
return $this->replace_tags( $template );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
|
|||||||
*/
|
*/
|
||||||
public function get_subject() {
|
public function get_subject() {
|
||||||
$propety_title = '';
|
$propety_title = '';
|
||||||
|
|
||||||
return sprintf( esc_html__( 'You have a message request reviewing: %s at', 'opalestate-pro' ), $propety_title );
|
return sprintf( esc_html__( 'You have a message request reviewing: %s at', 'opalestate-pro' ), $propety_title );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,15 +57,12 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
|
|||||||
* Send Email
|
* Send Email
|
||||||
*/
|
*/
|
||||||
public function get_body() {
|
public function get_body() {
|
||||||
|
|
||||||
$post = get_post( $this->args['post_id'] );
|
$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_link'] = get_permalink( $post->ID );
|
||||||
$this->args['property_name'] = $post->post_title;
|
$this->args['property_name'] = $post->post_title;
|
||||||
|
|
||||||
|
|
||||||
return parent::get_body();
|
return parent::get_body();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
@ -99,13 +99,13 @@ class OpalEstate_User_Message {
|
|||||||
|
|
||||||
|
|
||||||
$post['property_link'] = (int) $post['post_id'] ? get_permalink( $post['post_id'] ) : get_home_url();
|
$post['property_link'] = (int) $post['post_id'] ? get_permalink( $post['post_id'] ) : get_home_url();
|
||||||
$post['receive_name'] = $member['name'];
|
$post['receive_name'] = isset( $member['name'] ) ? $member['name'] : '';
|
||||||
$subject = html_entity_decode( esc_html__( 'You got a message', 'opalestate-pro' ) );
|
$subject = html_entity_decode( esc_html__( 'You got a message', 'opalestate-pro' ) );
|
||||||
$post['receiver_name'] = $member['receiver_name'];
|
$post['receiver_name'] = $member['receiver_name'];
|
||||||
|
|
||||||
$output = [
|
$output = [
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
'name' => $member['name'],
|
'name' => isset( $member['name'] ) ? $member['name'] : '',
|
||||||
'receiver_email' => $member['receiver_email'],
|
'receiver_email' => $member['receiver_email'],
|
||||||
'receiver_id' => $member['receiver_id'],
|
'receiver_id' => $member['receiver_id'],
|
||||||
'sender_id' => get_current_user_id(),
|
'sender_id' => get_current_user_id(),
|
||||||
@ -241,20 +241,16 @@ class OpalEstate_User_Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Process send email.
|
||||||
*/
|
*/
|
||||||
public function process_send_email() {
|
public function process_send_email() {
|
||||||
|
|
||||||
do_action( 'opalestate_process_send_email_before' );
|
do_action( 'opalestate_process_send_email_before' );
|
||||||
|
|
||||||
if ( isset( $_POST['type'] ) && $_POST['type'] ) {
|
if ( isset( $_POST['type'] ) && $_POST['type'] ) {
|
||||||
|
|
||||||
$content = [];
|
$content = [];
|
||||||
|
|
||||||
switch ( trim( $_POST['type'] ) ) {
|
switch ( trim( $_POST['type'] ) ) {
|
||||||
case 'send_equiry':
|
case 'send_equiry':
|
||||||
if ( wp_verify_nonce( $_POST['message_action'], 'send-enquiry-form' ) ) {
|
if ( wp_verify_nonce( $_POST['message_action'], 'send-enquiry-form' ) ) {
|
||||||
|
|
||||||
$member = $this->get_member_email_data( (int) $_POST['post_id'] );
|
$member = $this->get_member_email_data( (int) $_POST['post_id'] );
|
||||||
$content = $this->send_equiry( $_POST, $member );
|
$content = $this->send_equiry( $_POST, $member );
|
||||||
}
|
}
|
||||||
@ -269,8 +265,6 @@ class OpalEstate_User_Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( $content ) {
|
if ( $content ) {
|
||||||
|
|
||||||
|
|
||||||
// only save in db for user only
|
// only save in db for user only
|
||||||
if ( $content['receiver_id'] > 0 && $this->is_log ) {
|
if ( $content['receiver_id'] > 0 && $this->is_log ) {
|
||||||
$this->insert( $content );
|
$this->insert( $content );
|
||||||
|
@ -20,7 +20,8 @@ $id = 'send-enquiry-form';
|
|||||||
|
|
||||||
<?php do_action( 'opalestate_message_form_after' ); ?>
|
<?php do_action( 'opalestate_message_form_after' ); ?>
|
||||||
<?php wp_nonce_field( $id, 'message_action' ); ?>
|
<?php wp_nonce_field( $id, 'message_action' ); ?>
|
||||||
<button class="button btn btn-primary btn-3d" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> <?php esc_html_e( ' Processing', 'opalestate-pro' ); ?>" type="submit" name="contact-form"><?php echo esc_html__( 'Send message', 'opalestate-pro' ); ?></button>
|
<button class="button btn btn-primary btn-3d" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> <?php esc_html_e( ' Processing', 'opalestate-pro' ); ?>" type="submit"
|
||||||
|
name="contact-form"><?php echo esc_html__( 'Send message', 'opalestate-pro' ); ?></button>
|
||||||
</form>
|
</form>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<div class="opalestate-box-content property-equire-form">
|
<div class="opalestate-box-content property-equire-form">
|
||||||
@ -35,11 +36,11 @@ $id = 'send-enquiry-form';
|
|||||||
|
|
||||||
<?php do_action( 'opalestate_message_form_after' ); ?>
|
<?php do_action( 'opalestate_message_form_after' ); ?>
|
||||||
<?php wp_nonce_field( $id, 'message_action' ); ?>
|
<?php wp_nonce_field( $id, 'message_action' ); ?>
|
||||||
<button class="button btn btn-primary btn-3d" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> <?php esc_html_e( ' Processing', 'opalestate-pro' ); ?>" type="submit" name="contact-form"><?php echo esc_html__( 'Send message', 'opalestate-pro' ); ?></button>
|
<button class="button btn btn-primary btn-3d" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> <?php esc_html_e( ' Processing', 'opalestate-pro' ); ?>"
|
||||||
|
type="submit" name="contact-form"><?php echo esc_html__( 'Send message', 'opalestate-pro' ); ?></button>
|
||||||
</form>
|
</form>
|
||||||
</div><!-- /.agent-contact-form -->
|
</div><!-- /.agent-contact-form -->
|
||||||
</div><!-- /.agent-contact-->
|
</div><!-- /.agent-contact-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user