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 ) {
$( '.opalestate-message-notify', _this ).remove();
var action = $( _this ).data('action')? $( _this ).data('action') : 'send_email_contact';
console.log(action)
toggle_submit_button( _this );
$.ajax({
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 =
* Added - Required login to show Author box
* Added - Search field settings.

View File

@ -73,6 +73,7 @@ class Opalestate_Emails {
*/
public static function send_notifycation( $content ) {
$mail = new OpalEstate_Send_Email_Notification();
$mail->set_type( $content );
$mail->set_args( $content );
$return = self::send_mail_now( $mail );
@ -191,6 +192,51 @@ class Opalestate_Emails {
* render setting email fields with default values
*/
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>
<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
</div>
<div class="opalestate-template-tags-box">
<strong>{property_link}</strong> Link of the property
</div>
<div class="opalestate-template-tags-box">
<strong>{name}</strong> Name of the user who contact via email form
</div>
@ -211,6 +253,10 @@ class Opalestate_Emails {
<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>
@ -224,6 +270,7 @@ class Opalestate_Emails {
</div>
</div> ';
$contact_list_tags = apply_filters( 'opalestate_email_contact_tags', $contact_list_tags );
$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>
@ -232,10 +279,18 @@ class Opalestate_Emails {
<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>
@ -244,12 +299,16 @@ class Opalestate_Emails {
<strong>{email}</strong> Email of the user who contact via email form
</div>
<div class="opalestate-template-tags-box">
<strong>{schedule_date}</strong> Schedule date
</div>
<div class="opalestate-template-tags-box">
<strong>{schedule_time}</strong> Schedule time
</div>
<div class="opalestate-template-tags-box">
<strong>{schedule_date}</strong> Schedule date
<strong>{phone}</strong> Phone number of who sent via form
</div>
<div class="opalestate-template-tags-box">
@ -265,12 +324,13 @@ class Opalestate_Emails {
</div>
</div> ';
$review_list_tags = apply_filters( 'opalestate_email_review_tags', $review_list_tags );
$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>{property_name}</strong> Email of the user who made the property
<strong>{property_name}</strong> Name of the property
</div>
<div class="opalestate-template-tags-box">
@ -286,15 +346,11 @@ class Opalestate_Emails {
</div>
<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 class="opalestate-template-tags-box">
<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
<strong>{user_name}</strong> Name of the user who made the property
</div>
<div class="opalestate-template-tags-box">
@ -304,7 +360,7 @@ class Opalestate_Emails {
<strong>{site_link}</strong> A link to this website
</div>
<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>';
$list_tags = apply_filters( 'opalestate_email_tags', $list_tags );
@ -318,7 +374,7 @@ class Opalestate_Emails {
[
'name' => esc_html__( 'Email Settings', 'opalestate-pro' ),
'desc' => '<hr>',
'id' => 'opalestate_title_email_settings_1',
'id' => 'opalestate_title_email_settings',
'type' => 'title',
],
[
@ -340,7 +396,7 @@ class Opalestate_Emails {
[
'name' => esc_html__( 'Email Submission Templates (Template Tags)', 'opalestate-pro' ),
'desc' => $list_tags . '<br><hr>',
'id' => 'opalestate_title_email_settings_2',
'id' => 'opalestate_title_email_submission_template',
'type' => 'title',
],
@ -349,7 +405,7 @@ class Opalestate_Emails {
[
'name' => esc_html__( 'New Property Submission (Customer)', 'opalestate-pro' ),
'desc' => '<hr>',
'id' => 'opalestate_title_email_settings_3',
'id' => 'opalestate_title_email_new_property_customer',
'type' => 'title',
],
[
@ -386,7 +442,7 @@ class Opalestate_Emails {
[
'name' => esc_html__( 'New Property Submission (Admin)', 'opalestate-pro' ),
'desc' => '<hr>',
'id' => 'opalestate_title_email_settings_admin',
'id' => 'opalestate_title_email_new_property_admin',
'type' => 'title',
'before_row' => '<hr>',
],
@ -406,9 +462,6 @@ class Opalestate_Emails {
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
'type' => 'text',
'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' ),
],
@ -424,7 +477,7 @@ class Opalestate_Emails {
[
'name' => esc_html__( 'Approved property for publish (Customer)', 'opalestate-pro' ),
'desc' => '<hr>',
'id' => 'opalestate_title_email_settings_4',
'id' => 'opalestate_title_email_approved_property',
'type' => 'title',
'before_row' => '<hr>',
],
@ -444,12 +497,7 @@ class Opalestate_Emails {
'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__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' ),
'default' => esc_html__( 'New Property Listing Approved: {property_name}', 'opalestate-pro' ),
],
[
@ -461,9 +509,9 @@ class Opalestate_Emails {
],
/// enquire contact template ////
[
'name' => esc_html__( 'Email Enquiry Contact Templates (Template Tags)', 'opalestate-pro' ),
'desc' => $contact_list_tags . '<br><hr>',
'id' => 'opalestate_title_email_settings_6_1',
'name' => esc_html__( 'Email Enquire Contact Form (in the single property page)', 'opalestate-pro' ),
'desc' => $enquire_list_tags . '<br><hr>',
'id' => 'opalestate_title_email_enquire_contact',
'type' => 'title',
'before_row' => '<hr>',
],
@ -472,11 +520,6 @@ class Opalestate_Emails {
'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' ),
],
@ -486,38 +529,11 @@ class Opalestate_Emails {
'type' => 'wysiwyg',
'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 ///
[
'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>',
'id' => 'opalestate_title_email_settings_7',
'id' => 'opalestate_title_email_request_review',
'type' => 'title',
'before_row' => '<hr>',
],
@ -526,11 +542,6 @@ class Opalestate_Emails {
'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 have a message request reviewing', 'opalestate-pro' ),
],
@ -540,6 +551,28 @@ class Opalestate_Emails {
'type' => 'wysiwyg',
'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
*
* @return text: message
* @var $args array: property_id , $body
*/
public static function replace_shortcode( $args, $body ) {
@ -585,7 +617,7 @@ class Opalestate_Emails {
$submitted_date,
get_bloginfo( 'name' ),
get_home_url(),
date( "F j, Y, g:i a" ),
date_i18n( opalestate_email_date_format() ),
$property_name,
$property_link,
];

View File

@ -1,23 +1,10 @@
<?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' ) ) {
exit; // Exit if accessed directly
}
/**
* @class OpalEstate_Send_Email_Notification
* @class OpalEstate_Abstract_Email_Template
*
* @version 1.0
*/
@ -46,7 +33,6 @@ class OpalEstate_Abstract_Email_Template {
/**
* Get the description for this email notification.
*
* @type abstract
* @return string
*/
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() {
}
@ -72,12 +63,13 @@ class OpalEstate_Abstract_Email_Template {
'receiver_name' => '',
'name' => '',
'receiver_email' => '',
'property_name' => '',
'property_link' => '',
'property_edit_link' => '',
'message' => '',
'site_name' => get_bloginfo(),
'site_link' => get_home_url(),
'current_time' => date( "F j, Y, g:i a" ),
'current_time' => date_i18n( opalestate_email_date_format() ),
'phone' => '',
];
@ -112,7 +104,6 @@ class OpalEstate_Abstract_Email_Template {
}
public function get_body() {
$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_link' => get_permalink( $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;

View File

@ -36,7 +36,7 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
'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" ),
'current_time' => date_i18n( opalestate_email_date_format() ),
];
return $this->args;

View File

@ -1,17 +1,4 @@
<?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' ) ) {
exit; // Exit if accessed directly
}
@ -23,6 +10,15 @@ class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Templ
public $type = '';
public function set_type( $content ) {
$type = '';
if ( isset( $content['type'] ) && 'send_enquiry' === $content['type'] ) {
$type = 'enquiry';
}
$this->type = $type;
}
/**
* Send Email
*/
@ -43,7 +39,7 @@ class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Templ
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,
'property_name' => $property->post_title,
'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;

View File

@ -1,23 +1,10 @@
<?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' ) ) {
exit; // Exit if accessed directly
}
/**
* @class OpalEstate_Send_Email_Notification
* @class OpalEstate_Send_Email_Request_Reviewing
*
* @version 1.0
*/

View File

@ -115,6 +115,9 @@ class OpalEstate_User_Message {
$subject = html_entity_decode( esc_html__( 'You got a message', 'opalestate-pro' ) );
$post['receiver_name'] = $member['receiver_name'];
$property_id = absint( $post['post_id'] );
$property = get_post( $property_id );
$output = [
'subject' => $subject,
'name' => isset( $post['name'] ) ? $post['name'] : '',
@ -122,6 +125,9 @@ class OpalEstate_User_Message {
'receiver_id' => $member['receiver_id'],
'sender_id' => get_current_user_id(),
'sender_email' => $post['email'],
'property_name' => $property->post_title,
'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'],
@ -163,6 +169,7 @@ class OpalEstate_User_Message {
'post_id' => '',
'sender_id' => '',
'email' => '',
'name' => '',
'phone' => '',
'message' => '',
'message_action' => '',
@ -176,14 +183,13 @@ class OpalEstate_User_Message {
$post['receiver_name'] = $member['receiver_name'];
$output = [
'subject' => $subject,
'name' => $member['name'],
'receiver_email' => $member['receiver_email'],
'receiver_id' => $member['receiver_id'],
'sender_id' => get_current_user_id(),
'sender_email' => $post['email'],
'name' => $post['name'],
'phone' => $post['phone'],
'message' => $post['message'],
'post_id' => $post['post_id'],
@ -195,7 +201,6 @@ class OpalEstate_User_Message {
}
return $output;
}
/**
@ -258,7 +263,6 @@ class OpalEstate_User_Message {
do_action( 'opalestate_process_send_email_before' );
if ( isset( $_POST['type'] ) && $_POST['type'] ) {
$content = [];
switch ( trim( $_POST['type'] ) ) {
case 'send_equiry':
if ( wp_verify_nonce( $_POST['message_action'], 'send-enquiry-form' ) ) {

View File

@ -1294,6 +1294,7 @@ function opalestate_is_enable_areasize_field() {
function opalestate_is_require_login_to_show_author_box() {
$require = opalestate_get_option( 'enable_single_login_to_show_author_box', 'off' );
return ! ( $require == 'on' ) || ( $require == 'on' && is_user_logged_in() );
}
@ -1354,3 +1355,12 @@ function 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 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.
* Version: 1.3.3
* Version: 1.3.4
* Author: WPOPAL
* Author URI: http://www.wpopal.com
* Requires at least: 4.9
@ -150,7 +150,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
*/
public function __clone() {
// 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() {
// Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.3.3' );
define( 'OPALESTATE_VERSION', '1.3.4' );
}
// 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
Requires at least: 4.9
Tested up to: 5.3.2
Stable tag: 1.3.3
Stable tag: 1.3.4
License: GPLv3
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")
== Changelog ==
= 1.3.4 - 2020-02-21 =
* Fixes - Enquire email & Contact email
= 1.3.3 - 2020-02-20 =
* Added - Required login to show Author box
* Added - Search field settings.