From a82811aad94283ac736e6a4bb8c07e2a4f8d49ea Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Wed, 11 Dec 2019 15:28:54 +0700 Subject: [PATCH 1/3] Hotfix: Fix email approved. --- inc/class-opalestate-email.php | 19 ++++++++----------- inc/email/class-opalestate-approve.php | 25 ++----------------------- 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/inc/class-opalestate-email.php b/inc/class-opalestate-email.php index e35259bb..1580b695 100755 --- a/inc/class-opalestate-email.php +++ b/inc/class-opalestate-email.php @@ -150,28 +150,30 @@ class Opalestate_Emails { * */ public static function send_email_when_publish_property( $new_status, $old_status, $post ) { - if ( is_object( $post ) ) { if ( $post->post_type == 'opalestate_property' ) { if ( $new_status != $old_status ) { if ( $new_status == 'publish' ) { if ( $old_status == 'draft' || $old_status == 'pending' ) { // Send email - $post_id = $post->ID; - do_action( "opalestate_processed_approve_publish_property", $post_id ); + $post_id = $post->ID; + $author_id = $post->post_author; + $author = get_userdata( $author_id ); + + if ( ! in_array( 'administrator', $author->roles ) && ! in_array( 'opalestate_manager', $author->roles ) && ! in_array( 'opalmembership_manager', $author->roles ) ) { + do_action( 'opalestate_processed_approve_publish_property', $post_id ); + } } } } } } - } /** * add new tab Email in opalestate -> setting */ public static function setting_email_tab( $tabs ) { - $tabs['emails'] = esc_html__( 'Email', 'opalestate-pro' ); return $tabs; @@ -594,16 +596,11 @@ class Opalestate_Emails { } public static function approve_publish_property_email( $post_id ) { - $mail = new OpalEstate_Send_Email_Approve(); $mail->set_pros( $post_id ); - $return = self::send_mail_now( $mail ); - - echo json_encode( $return ); - die(); + self::send_mail_now( $mail ); } - } Opalestate_Emails::init(); diff --git a/inc/email/class-opalestate-approve.php b/inc/email/class-opalestate-approve.php index a33b530a..dc1d0903 100644 --- a/inc/email/class-opalestate-approve.php +++ b/inc/email/class-opalestate-approve.php @@ -1,23 +1,10 @@ - * @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_Approve * * @version 1.0 */ @@ -28,7 +15,7 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template { */ public function get_subject() { $subject = esc_html__( 'The Property Listing Approved: {property_name}', 'opalestate-pro' ); - $subject = opalestate_options( 'approve_email_body', $subject ); + $subject = opalestate_options( 'approve_email_subject', $subject ); return $this->replace_tags( $subject ); } @@ -59,7 +46,6 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template { * */ public function get_content_template() { - $content = opalestate_options( 'approve_email_body', self::get_default_template() ); return $content; @@ -69,7 +55,6 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template { * */ public static function get_default_template() { - return trim( preg_replace( '/\t+/', '', "Hi {user_name},

Thank you so much for submitting to {site_name}. @@ -102,14 +87,8 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template { * */ 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; return parent::get_body(); } } - -?> From 23108c3cf7eade042dd4efeb30bd63b693fd010f Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Wed, 11 Dec 2019 15:59:02 +0700 Subject: [PATCH 2/3] Fix order properties. --- inc/property/class-opalestate-search.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/inc/property/class-opalestate-search.php b/inc/property/class-opalestate-search.php index fb98abe0..7b5aba87 100755 --- a/inc/property/class-opalestate-search.php +++ b/inc/property/class-opalestate-search.php @@ -241,13 +241,17 @@ class OpalEstate_Search { } if ( ! empty( $ksearchs ) && count( $ksearchs ) == 2 ) { - $args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . $ksearchs[0]; - $args['orderby'] = ( 'featured' !== $ksearchs[0] ) ? 'meta_value_num' : 'meta_value'; - $args['order'] = $ksearchs[1]; + if ( 'featured' === $ksearchs[0] ) { + $args['orderby'] = [ 'meta_value' => 'DESC', 'date' => 'DESC' ]; + $args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . 'featured'; + } else { + $args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . $ksearchs[0]; + $args['orderby'] = 'meta_value_num'; + $args['order'] = $ksearchs[1]; + } } elseif ( 'on' == opalestate_options( 'show_featured_first', 'off' ) ) { + $args['orderby'] = [ 'meta_value' => 'DESC', 'date' => 'DESC' ]; $args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . 'featured'; - $args['orderby'] = 'meta_value'; - $args['order'] = 'DESC'; } $metas = Opalestate_Property_MetaBox::metaboxes_info_fields(); From 11b48e970c4587738f45cecdcfc1449f010b62b5 Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Wed, 11 Dec 2019 16:00:30 +0700 Subject: [PATCH 3/3] Tag 1.2.4 --- opal-estate-pro.php | 6 +++--- readme.txt | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/opal-estate-pro.php b/opal-estate-pro.php index 3469c825..630b199a 100755 --- a/opal-estate-pro.php +++ b/opal-estate-pro.php @@ -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.2.3 + * Version: 1.2.4 * Author: WPOPAL * Author URI: http://www.wpopal.com * Requires at least: 4.6 @@ -151,7 +151,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { */ public function __clone() { // Cloning instances of the class is forbidden - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.2.3' ); + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.2.4' ); } /** @@ -160,7 +160,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { public function setup_constants() { // Plugin version if ( ! defined( 'OPALESTATE_VERSION' ) ) { - define( 'OPALESTATE_VERSION', '1.2.3' ); + define( 'OPALESTATE_VERSION', '1.2.4' ); } // Plugin Folder Path diff --git a/readme.txt b/readme.txt index 3bfbd437..dd791e45 100755 --- a/readme.txt +++ b/readme.txt @@ -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.6 Tested up to: 5.3 -Stable tag: 1.2.2 +Stable tag: 1.2.4 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -156,6 +156,10 @@ 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.2.4 - 2019-12-11 = +* Fixes - Order properties with featured properties. +* Fixes - Email approved. + = 1.2.3 - 2019-12-09 = * Fixes - Order properties * Fixes - Package template.