Fix Enquire email & Contact email

This commit is contained in:
Hoang Huu 2020-02-21 11:13:46 +07:00
parent 103f4954aa
commit 4ccc93892f
13 changed files with 198 additions and 173 deletions

View File

@ -120,7 +120,6 @@ 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',

View File

@ -1,3 +1,6 @@
= 1.3.4 - 2020-02-21 =
* Fixes - Enquire email & Contact email
= 1.3.3 - 2020-02-20 = = 1.3.3 - 2020-02-20 =
* Added - Required login to show Author box * Added - Required login to show Author box
* Added - Search field settings. * Added - Search field settings.

View File

@ -73,6 +73,7 @@ class Opalestate_Emails {
*/ */
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_type( $content );
$mail->set_args( $content ); $mail->set_args( $content );
$return = self::send_mail_now( $mail ); $return = self::send_mail_now( $mail );
@ -191,6 +192,51 @@ class Opalestate_Emails {
* render setting email fields with default values * render setting email fields with default values
*/ */
public static function setting_email_fields( $fields ) { public static function setting_email_fields( $fields ) {
$enquire_list_tags = '<div>
<p class="tags-description">Use the following tags to automatically add property information to the emails. Tags labeled with an asterisk (*) can be used in the email subject as well.</p>
<div class="opalestate-template-tags-box">
<strong>{receive_name}</strong> Name of the agent who made the property
</div>
<div class="opalestate-template-tags-box">
<strong>{property_name}</strong> Name of the property
</div>
<div class="opalestate-template-tags-box">
<strong>{property_link}</strong> Link of the property
</div>
<div class="opalestate-template-tags-box">
<strong>{property_edit_link}</strong> Link for editing of the property (admin)
</div>
<div class="opalestate-template-tags-box">
<strong>{name}</strong> Name of the user who contact via email form
</div>
<div class="opalestate-template-tags-box">
<strong>{email}</strong> Email of the user who contact via email form
</div>
<div class="opalestate-template-tags-box">
<strong>{phone}</strong> Phone number of who sent via form
</div>
<div class="opalestate-template-tags-box">
<strong>{message}</strong> Message content of who sent via form
</div>
<div class="opalestate-template-tags-box">
<strong>{site_link}</strong> A link to this website
</div>
<div class="opalestate-template-tags-box">
<strong>{current_time}</strong> Current date and time
</div>
</div> ';
$enquire_list_tags = apply_filters( 'opalestate_email_enquire_tags', $enquire_list_tags );
$contact_list_tags = '<div> $contact_list_tags = '<div>
<p class="tags-description">Use the following tags to automatically add property information to the emails. Tags labeled with an asterisk (*) can be used in the email subject as well.</p> <p class="tags-description">Use the following tags to automatically add property information to the emails. Tags labeled with an asterisk (*) can be used in the email subject as well.</p>
@ -199,10 +245,6 @@ class Opalestate_Emails {
<strong>{receive_name}</strong> Name of the agent who made the property <strong>{receive_name}</strong> Name of the agent who made the property
</div> </div>
<div class="opalestate-template-tags-box">
<strong>{property_link}</strong> Link of the property
</div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
<strong>{name}</strong> Name of the user who contact via email form <strong>{name}</strong> Name of the user who contact via email form
</div> </div>
@ -211,6 +253,10 @@ class Opalestate_Emails {
<strong>{email}</strong> Email of the user who contact via email form <strong>{email}</strong> Email of the user who contact via email form
</div> </div>
<div class="opalestate-template-tags-box">
<strong>{phone}</strong> Phone number of who sent via form
</div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
<strong>{message}</strong> * Message content of who sent via form <strong>{message}</strong> * Message content of who sent via form
</div> </div>
@ -224,6 +270,7 @@ class Opalestate_Emails {
</div> </div>
</div> '; </div> ';
$contact_list_tags = apply_filters( 'opalestate_email_contact_tags', $contact_list_tags );
$review_list_tags = '<div> $review_list_tags = '<div>
<p class="tags-description">Use the following tags to automatically add property information to the emails. Tags labeled with an asterisk (*) can be used in the email subject as well.</p> <p class="tags-description">Use the following tags to automatically add property information to the emails. Tags labeled with an asterisk (*) can be used in the email subject as well.</p>
@ -232,10 +279,18 @@ class Opalestate_Emails {
<strong>{receive_name}</strong> Name of the agent who made the property <strong>{receive_name}</strong> Name of the agent who made the property
</div> </div>
<div class="opalestate-template-tags-box">
<strong>{property_name}</strong> Name of the property
</div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
<strong>{property_link}</strong> Link of the property <strong>{property_link}</strong> Link of the property
</div> </div>
<div class="opalestate-template-tags-box">
<strong>{property_edit_link}</strong> Link for editing of the property (admin)
</div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
<strong>{name}</strong> Name of the user who contact via email form <strong>{name}</strong> Name of the user who contact via email form
</div> </div>
@ -244,12 +299,16 @@ class Opalestate_Emails {
<strong>{email}</strong> Email of the user who contact via email form <strong>{email}</strong> Email of the user who contact via email form
</div> </div>
<div class="opalestate-template-tags-box">
<strong>{schedule_date}</strong> Schedule date
</div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
<strong>{schedule_time}</strong> Schedule time <strong>{schedule_time}</strong> Schedule time
</div> </div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
<strong>{schedule_date}</strong> Schedule date <strong>{phone}</strong> Phone number of who sent via form
</div> </div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
@ -265,12 +324,13 @@ class Opalestate_Emails {
</div> </div>
</div> '; </div> ';
$review_list_tags = apply_filters( 'opalestate_email_review_tags', $review_list_tags );
$list_tags = '<div> $list_tags = '<div>
<p class="tags-description">Use the following tags to automatically add property information to the emails. Tags labeled with an asterisk (*) can be used in the email subject as well.</p> <p class="tags-description">Use the following tags to automatically add property information to the emails. Tags labeled with an asterisk (*) can be used in the email subject as well.</p>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
<strong>{property_name}</strong> Email of the user who made the property <strong>{property_name}</strong> Name of the property
</div> </div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
@ -286,15 +346,11 @@ class Opalestate_Emails {
</div> </div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
<strong>{submitted_date}</strong> Email of the user who made the property <strong>{submitted_date}</strong> Submitted date
</div> </div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
<strong>{user_name}</strong> * Name of the user who made the property <strong>{user_name}</strong> Name of the user who made the property
</div>
<div class="opalestate-template-tags-box">
<strong>{date}</strong> * Date and time of the property
</div> </div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
@ -304,7 +360,7 @@ class Opalestate_Emails {
<strong>{site_link}</strong> A link to this website <strong>{site_link}</strong> A link to this website
</div> </div>
<div class="opalestate-template-tags-box"> <div class="opalestate-template-tags-box">
<strong>{current_time}</strong> Current date and time <strong>{current_time}</strong> Current date and time when email sent
</div></div>'; </div></div>';
$list_tags = apply_filters( 'opalestate_email_tags', $list_tags ); $list_tags = apply_filters( 'opalestate_email_tags', $list_tags );
@ -318,7 +374,7 @@ class Opalestate_Emails {
[ [
'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',
'type' => 'title', 'type' => 'title',
], ],
[ [
@ -340,7 +396,7 @@ class Opalestate_Emails {
[ [
'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_submission_template',
'type' => 'title', 'type' => 'title',
], ],
@ -349,7 +405,7 @@ class Opalestate_Emails {
[ [
'name' => esc_html__( 'New Property Submission (Customer)', 'opalestate-pro' ), 'name' => esc_html__( 'New Property Submission (Customer)', 'opalestate-pro' ),
'desc' => '<hr>', 'desc' => '<hr>',
'id' => 'opalestate_title_email_settings_3', 'id' => 'opalestate_title_email_new_property_customer',
'type' => 'title', 'type' => 'title',
], ],
[ [
@ -386,7 +442,7 @@ class Opalestate_Emails {
[ [
'name' => esc_html__( 'New Property Submission (Admin)', 'opalestate-pro' ), 'name' => esc_html__( 'New Property Submission (Admin)', 'opalestate-pro' ),
'desc' => '<hr>', 'desc' => '<hr>',
'id' => 'opalestate_title_email_settings_admin', 'id' => 'opalestate_title_email_new_property_admin',
'type' => 'title', 'type' => 'title',
'before_row' => '<hr>', 'before_row' => '<hr>',
], ],
@ -406,9 +462,6 @@ class Opalestate_Emails {
'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' => [
'rows' => 3,
],
'default' => esc_html__( 'You received a new submission: {property_name} from {user_mail}', 'opalestate-pro' ), 'default' => esc_html__( 'You received a new submission: {property_name} from {user_mail}', 'opalestate-pro' ),
], ],
@ -424,7 +477,7 @@ class Opalestate_Emails {
[ [
'name' => esc_html__( 'Approved property for publish (Customer)', 'opalestate-pro' ), 'name' => esc_html__( 'Approved property for publish (Customer)', 'opalestate-pro' ),
'desc' => '<hr>', 'desc' => '<hr>',
'id' => 'opalestate_title_email_settings_4', 'id' => 'opalestate_title_email_approved_property',
'type' => 'title', 'type' => 'title',
'before_row' => '<hr>', 'before_row' => '<hr>',
], ],
@ -444,12 +497,7 @@ class Opalestate_Emails {
'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' => [ 'default' => esc_html__( 'New Property Listing Approved: {property_name}', 'opalestate-pro' ),
'placeholder' => 'Your property at I Love WordPress is pending',
get_bloginfo( 'name' ),
'rows' => 3,
],
'default' => esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' ),
], ],
[ [
@ -461,9 +509,9 @@ class Opalestate_Emails {
], ],
/// enquire contact template //// /// enquire contact template ////
[ [
'name' => esc_html__( 'Email Enquiry Contact Templates (Template Tags)', 'opalestate-pro' ), 'name' => esc_html__( 'Email Enquire Contact Form (in the single property page)', 'opalestate-pro' ),
'desc' => $contact_list_tags . '<br><hr>', 'desc' => $enquire_list_tags . '<br><hr>',
'id' => 'opalestate_title_email_settings_6_1', 'id' => 'opalestate_title_email_enquire_contact',
'type' => 'title', 'type' => 'title',
'before_row' => '<hr>', 'before_row' => '<hr>',
], ],
@ -472,11 +520,6 @@ class Opalestate_Emails {
'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' => [
'placeholder' => 'Your property at I Love WordPress is pending',
get_bloginfo( 'name' ),
'rows' => 3,
],
'default' => esc_html__( 'You got a message', 'opalestate-pro' ), 'default' => esc_html__( 'You got a message', 'opalestate-pro' ),
], ],
@ -486,38 +529,11 @@ class Opalestate_Emails {
'type' => 'wysiwyg', 'type' => 'wysiwyg',
'default' => OpalEstate_Send_Email_Notification::get_default_template( 'enquiry' ), 'default' => OpalEstate_Send_Email_Notification::get_default_template( 'enquiry' ),
], ],
/// email contact template ////
[
'name' => esc_html__( 'Email Contact Templates (Template Tags)', 'opalestate-pro' ),
'desc' => $contact_list_tags . '<br><hr>',
'id' => 'opalestate_title_email_settings_6',
'type' => 'title',
'before_row' => '<hr>',
],
[
'id' => 'contact_email_subject',
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
'type' => 'text',
'desc' => esc_html__( 'The email subject a user should receive when they make an initial property request.', 'opalestate-pro' ),
'attributes' => [
'placeholder' => 'Your property at I Love WordPress is pending',
get_bloginfo( 'name' ),
'rows' => 3,
],
'default' => esc_html__( 'You got a message', 'opalestate-pro' ),
],
[
'id' => 'contact_email_body',
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
'type' => 'wysiwyg',
'default' => OpalEstate_Send_Email_Notification::get_default_template(),
],
/// Email Request Review /// /// Email Request Review ///
[ [
'name' => esc_html__( 'Email Request Review Templates (Template Tags)', 'opalestate-pro' ), 'name' => esc_html__( 'Email Request Review Form (in the single property page)', 'opalestate-pro' ),
'desc' => $review_list_tags . '<br><hr>', 'desc' => $review_list_tags . '<br><hr>',
'id' => 'opalestate_title_email_settings_7', 'id' => 'opalestate_title_email_request_review',
'type' => 'title', 'type' => 'title',
'before_row' => '<hr>', 'before_row' => '<hr>',
], ],
@ -526,11 +542,6 @@ class Opalestate_Emails {
'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' => [
'placeholder' => 'Your property at I Love WordPress is pending',
get_bloginfo( 'name' ),
'rows' => 3,
],
'default' => esc_html__( 'You have a message request reviewing', 'opalestate-pro' ), 'default' => esc_html__( 'You have a message request reviewing', 'opalestate-pro' ),
], ],
@ -540,6 +551,28 @@ class Opalestate_Emails {
'type' => 'wysiwyg', 'type' => 'wysiwyg',
'default' => OpalEstate_Send_Email_Request_Reviewing::get_default_template(), 'default' => OpalEstate_Send_Email_Request_Reviewing::get_default_template(),
], ],
/// email contact template ////
[
'name' => esc_html__( 'Email Contact Host Form (in the Agent/Agency page)', 'opalestate-pro' ),
'desc' => $contact_list_tags . '<br><hr>',
'id' => 'opalestate_title_email_contact_author_form',
'type' => 'title',
'before_row' => '<hr>',
],
[
'id' => 'contact_email_subject',
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
'type' => 'text',
'desc' => esc_html__( 'The email subject a user should receive when they make an initial property request.', 'opalestate-pro' ),
'default' => esc_html__( 'You got a message', 'opalestate-pro' ),
],
[
'id' => 'contact_email_body',
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
'type' => 'wysiwyg',
'default' => OpalEstate_Send_Email_Notification::get_default_template(),
],
] ]
), ),
]; ];
@ -550,7 +583,6 @@ class Opalestate_Emails {
/** /**
* get data of newrequest email * get data of newrequest email
* *
* @return text: message
* @var $args array: property_id , $body * @var $args array: property_id , $body
*/ */
public static function replace_shortcode( $args, $body ) { public static function replace_shortcode( $args, $body ) {
@ -585,7 +617,7 @@ class Opalestate_Emails {
$submitted_date, $submitted_date,
get_bloginfo( 'name' ), get_bloginfo( 'name' ),
get_home_url(), get_home_url(),
date( "F j, Y, g:i a" ), date_i18n( opalestate_email_date_format() ),
$property_name, $property_name,
$property_link, $property_link,
]; ];

View File

@ -1,23 +1,10 @@
<?php <?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
/** /**
* @class OpalEstate_Send_Email_Notification * @class OpalEstate_Abstract_Email_Template
* *
* @version 1.0 * @version 1.0
*/ */
@ -46,7 +33,6 @@ class OpalEstate_Abstract_Email_Template {
/** /**
* Get the description for this email notification. * Get the description for this email notification.
* *
* @type abstract
* @return string * @return string
*/ */
public function get_description() { public function get_description() {
@ -57,6 +43,11 @@ class OpalEstate_Abstract_Email_Template {
} }
/**
* Get the content for this email notification.
*
* @return string
*/
public function get_content_template() { public function get_content_template() {
} }
@ -72,12 +63,13 @@ class OpalEstate_Abstract_Email_Template {
'receiver_name' => '', 'receiver_name' => '',
'name' => '', 'name' => '',
'receiver_email' => '', 'receiver_email' => '',
'property_name' => '',
'property_link' => '', 'property_link' => '',
'property_edit_link' => '', 'property_edit_link' => '',
'message' => '', 'message' => '',
'site_name' => get_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_i18n( opalestate_email_date_format() ),
'phone' => '', 'phone' => '',
]; ];
@ -112,7 +104,6 @@ class OpalEstate_Abstract_Email_Template {
} }
public function get_body() { public function get_body() {
$template = $this->get_content_template(); $template = $this->get_content_template();

View File

@ -44,7 +44,7 @@ class OpalEstate_Send_Email_Admin_New_Submitted extends OpalEstate_Abstract_Emai
'property_name' => $property->post_title, 'property_name' => $property->post_title,
'property_link' => get_permalink( $property_id ), 'property_link' => get_permalink( $property_id ),
'property_edit_link' => get_edit_post_link( $property_id ), 'property_edit_link' => get_edit_post_link( $property_id ),
'current_time' => date( "F j, Y, g:i a" ), 'current_time' => date_i18n( opalestate_email_date_format() ),
]; ];
return $this->args; return $this->args;

View File

@ -36,7 +36,7 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
'submitted_date' => $property->post_date, 'submitted_date' => $property->post_date,
'property_name' => $property->post_title, 'property_name' => $property->post_title,
'property_link' => get_permalink( $property_id ), 'property_link' => get_permalink( $property_id ),
'current_time' => date( "F j, Y, g:i a" ), 'current_time' => date_i18n( opalestate_email_date_format() ),
]; ];
return $this->args; return $this->args;

View File

@ -1,17 +1,4 @@
<?php <?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
@ -23,6 +10,15 @@ class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Templ
public $type = ''; public $type = '';
public function set_type( $content ) {
$type = '';
if ( isset( $content['type'] ) && 'send_enquiry' === $content['type'] ) {
$type = 'enquiry';
}
$this->type = $type;
}
/** /**
* Send Email * Send Email
*/ */
@ -43,7 +39,7 @@ class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Templ
break; break;
} }
return $subject; return $this->replace_tags( $subject );
} }
/** /**

View File

@ -48,7 +48,7 @@ class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Temp
'submitted_date' => $property->post_date, 'submitted_date' => $property->post_date,
'property_name' => $property->post_title, 'property_name' => $property->post_title,
'property_link' => get_permalink( $property_id ), 'property_link' => get_permalink( $property_id ),
'current_time' => date( "F j, Y, g:i a" ), 'current_time' => date_i18n( opalestate_email_date_format() ),
]; ];
return $this->args; return $this->args;

View File

@ -1,23 +1,10 @@
<?php <?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
/** /**
* @class OpalEstate_Send_Email_Notification * @class OpalEstate_Send_Email_Request_Reviewing
* *
* @version 1.0 * @version 1.0
*/ */

View File

@ -115,18 +115,24 @@ class OpalEstate_User_Message {
$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 = [ $property_id = absint( $post['post_id'] );
'subject' => $subject, $property = get_post( $property_id );
'name' => isset( $post['name'] ) ? $post['name'] : '',
'receiver_email' => $member['receiver_email'], $output = [
'receiver_id' => $member['receiver_id'], 'subject' => $subject,
'sender_id' => get_current_user_id(), 'name' => isset( $post['name'] ) ? $post['name'] : '',
'sender_email' => $post['email'], 'receiver_email' => $member['receiver_email'],
'email' => $post['email'], 'receiver_id' => $member['receiver_id'],
'phone' => $post['phone'], 'sender_id' => get_current_user_id(),
'message' => $post['message'], 'sender_email' => $post['email'],
'post_id' => $post['post_id'], 'property_name' => $property->post_title,
'type' => 'send_enquiry', 'property_link' => $property_id ? get_permalink( $property_id ) : get_home_url(),
'property_edit_link' => get_edit_post_link( $property_id ),
'email' => $post['email'],
'phone' => $post['phone'],
'message' => $post['message'],
'post_id' => $post['post_id'],
'type' => 'send_enquiry',
]; ];
if ( $output['sender_id'] == $output['receiver_id'] ) { if ( $output['sender_id'] == $output['receiver_id'] ) {
@ -163,6 +169,7 @@ class OpalEstate_User_Message {
'post_id' => '', 'post_id' => '',
'sender_id' => '', 'sender_id' => '',
'email' => '', 'email' => '',
'name' => '',
'phone' => '', 'phone' => '',
'message' => '', 'message' => '',
'message_action' => '', 'message_action' => '',
@ -176,14 +183,13 @@ class OpalEstate_User_Message {
$post['receiver_name'] = $member['receiver_name']; $post['receiver_name'] = $member['receiver_name'];
$output = [ $output = [
'subject' => $subject, 'subject' => $subject,
'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(),
'sender_email' => $post['email'], 'sender_email' => $post['email'],
'name' => $post['name'],
'phone' => $post['phone'], 'phone' => $post['phone'],
'message' => $post['message'], 'message' => $post['message'],
'post_id' => $post['post_id'], 'post_id' => $post['post_id'],
@ -195,7 +201,6 @@ class OpalEstate_User_Message {
} }
return $output; return $output;
} }
/** /**
@ -258,7 +263,6 @@ class OpalEstate_User_Message {
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' ) ) {
@ -680,48 +684,48 @@ class OpalEstate_User_Message {
$fields = [ $fields = [
[ [
'id' => 'type', 'id' => 'type',
'name' => esc_html__( 'Type', 'opalestate-pro' ), 'name' => esc_html__( 'Type', 'opalestate-pro' ),
'type' => 'hidden', 'type' => 'hidden',
'default' => 'send_request_review', 'default' => 'send_request_review',
], ],
[ [
'id' => 'post_id', 'id' => 'post_id',
'name' => esc_html__( 'Property ID', 'opalestate-pro' ), 'name' => esc_html__( 'Property ID', 'opalestate-pro' ),
'type' => 'hidden', 'type' => 'hidden',
'default' => $post_id, 'default' => $post_id,
], ],
[ [
'id' => 'sender_id', 'id' => 'sender_id',
'name' => esc_html__( 'Sender ID', 'opalestate-pro' ), 'name' => esc_html__( 'Sender ID', 'opalestate-pro' ),
'type' => 'hidden', 'type' => 'hidden',
'default' => $sender_id, 'default' => $sender_id,
], ],
[ [
'id' => "{$prefix}date", 'id' => "{$prefix}date",
'name' => esc_html__( 'Schedule', 'opalestate-pro' ), 'name' => esc_html__( 'Schedule', 'opalestate-pro' ),
'type' => 'date', 'type' => 'date',
'before_row' => '', 'before_row' => '',
'required' => 'required', 'required' => 'required',
], ],
[ [
'id' => "{$prefix}time", 'id' => "{$prefix}time",
'name' => esc_html__( 'Time', 'opalestate-pro' ), 'name' => esc_html__( 'Time', 'opalestate-pro' ),
'type' => 'select', 'type' => 'select',
'options' => opalestate_get_time_lapses(), 'options' => opalestate_get_time_lapses(),
], ],
[ [
'id' => "{$prefix}phone", 'id' => "{$prefix}phone",
'name' => esc_html__( 'Phone', 'opalestate-pro' ), 'name' => esc_html__( 'Phone', 'opalestate-pro' ),
'type' => 'text', 'type' => 'text',
'required' => 'required', 'required' => 'required',
], ],
[ [
'id' => "{$prefix}message", 'id' => "{$prefix}message",
'name' => esc_html__( 'Message', 'opalestate-pro' ), 'name' => esc_html__( 'Message', 'opalestate-pro' ),
'type' => 'textarea', 'type' => 'textarea',
'default' => $msg, 'default' => $msg,
'required' => 'required', 'required' => 'required',
], ],
]; ];

View File

@ -1293,8 +1293,9 @@ function opalestate_is_enable_areasize_field() {
} }
function opalestate_is_require_login_to_show_author_box() { function opalestate_is_require_login_to_show_author_box() {
$require = opalestate_get_option( 'enable_single_login_to_show_author_box', 'off' ); $require = opalestate_get_option( 'enable_single_login_to_show_author_box', 'off' );
return ! ( $require == 'on' ) || ( $require == 'on' && is_user_logged_in() );
return ! ( $require == 'on' ) || ( $require == 'on' && is_user_logged_in() );
} }
/** /**
@ -1354,3 +1355,12 @@ function opalestate_widgets_init() {
} }
add_action( 'widgets_init', 'opalestate_widgets_init' ); add_action( 'widgets_init', 'opalestate_widgets_init' );
/**
* Get email date format.
*
* @return mixed|void
*/
function opalestate_email_date_format() {
return apply_filters( 'opalestate_email_date_format', 'F j, Y, g:i a' );
}

View File

@ -3,7 +3,7 @@
* Plugin Name: Opal Estate Pro * Plugin Name: Opal Estate Pro
* Plugin URI: https://wpdocs.gitbook.io/opal-estate/ * Plugin URI: https://wpdocs.gitbook.io/opal-estate/
* Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website. * Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website.
* Version: 1.3.3 * Version: 1.3.4
* Author: WPOPAL * Author: WPOPAL
* Author URI: http://www.wpopal.com * Author URI: http://www.wpopal.com
* Requires at least: 4.9 * Requires at least: 4.9
@ -150,7 +150,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
*/ */
public function __clone() { public function __clone() {
// Cloning instances of the class is forbidden // Cloning instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.3.3' ); _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.3.4' );
} }
/** /**
@ -159,7 +159,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() { public function setup_constants() {
// Plugin version // Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) { if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.3.3' ); define( 'OPALESTATE_VERSION', '1.3.4' );
} }
// Plugin Folder Path // Plugin Folder Path

View File

@ -4,7 +4,7 @@ Donate link: https://wpdocs.gitbook.io/opal-estate/
Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace
Requires at least: 4.9 Requires at least: 4.9
Tested up to: 5.3.2 Tested up to: 5.3.2
Stable tag: 1.3.3 Stable tag: 1.3.4
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -156,6 +156,9 @@ This section describes how to install the plugin and get it working.
* System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page") * System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page")
== Changelog == == Changelog ==
= 1.3.4 - 2020-02-21 =
* Fixes - Enquire email & Contact email
= 1.3.3 - 2020-02-20 = = 1.3.3 - 2020-02-20 =
* Added - Required login to show Author box * Added - Required login to show Author box
* Added - Search field settings. * Added - Search field settings.