Merge pull request #23 from wpopal/develop

Develop
This commit is contained in:
wpopal 2019-12-11 16:01:23 +07:00 committed by GitHub
commit 37816633d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 43 deletions

View File

@ -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();

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_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},<br>
<br>
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();
}
}
?>

View File

@ -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();

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.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&#8217; huh?', 'opalestate-pro' ), '1.2.3' );
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; 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

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.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.