Hotfix: Fix email approved.
This commit is contained in:
parent
46378081f5
commit
a82811aad9
@ -150,7 +150,6 @@ class Opalestate_Emails {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function send_email_when_publish_property( $new_status, $old_status, $post ) {
|
public static function send_email_when_publish_property( $new_status, $old_status, $post ) {
|
||||||
|
|
||||||
if ( is_object( $post ) ) {
|
if ( is_object( $post ) ) {
|
||||||
if ( $post->post_type == 'opalestate_property' ) {
|
if ( $post->post_type == 'opalestate_property' ) {
|
||||||
if ( $new_status != $old_status ) {
|
if ( $new_status != $old_status ) {
|
||||||
@ -158,20 +157,23 @@ class Opalestate_Emails {
|
|||||||
if ( $old_status == 'draft' || $old_status == 'pending' ) {
|
if ( $old_status == 'draft' || $old_status == 'pending' ) {
|
||||||
// Send email
|
// Send email
|
||||||
$post_id = $post->ID;
|
$post_id = $post->ID;
|
||||||
do_action( "opalestate_processed_approve_publish_property", $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
|
* add new tab Email in opalestate -> setting
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
@ -594,16 +596,11 @@ class Opalestate_Emails {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function approve_publish_property_email( $post_id ) {
|
public static function approve_publish_property_email( $post_id ) {
|
||||||
|
|
||||||
$mail = new OpalEstate_Send_Email_Approve();
|
$mail = new OpalEstate_Send_Email_Approve();
|
||||||
$mail->set_pros( $post_id );
|
$mail->set_pros( $post_id );
|
||||||
|
|
||||||
$return = self::send_mail_now( $mail );
|
self::send_mail_now( $mail );
|
||||||
|
|
||||||
echo json_encode( $return );
|
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Opalestate_Emails::init();
|
Opalestate_Emails::init();
|
||||||
|
@ -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_Approve
|
||||||
*
|
*
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
@ -28,7 +15,7 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
|||||||
*/
|
*/
|
||||||
public function get_subject() {
|
public function get_subject() {
|
||||||
$subject = esc_html__( 'The Property Listing Approved: {property_name}', 'opalestate-pro' );
|
$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 );
|
return $this->replace_tags( $subject );
|
||||||
}
|
}
|
||||||
@ -59,7 +46,6 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function get_content_template() {
|
public function get_content_template() {
|
||||||
|
|
||||||
$content = opalestate_options( 'approve_email_body', self::get_default_template() );
|
$content = opalestate_options( 'approve_email_body', self::get_default_template() );
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
@ -69,7 +55,6 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function get_default_template() {
|
public static function get_default_template() {
|
||||||
|
|
||||||
return trim( preg_replace( '/\t+/', '', "Hi {user_name},<br>
|
return trim( preg_replace( '/\t+/', '', "Hi {user_name},<br>
|
||||||
<br>
|
<br>
|
||||||
Thank you so much for submitting to {site_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() {
|
public function get_body() {
|
||||||
|
|
||||||
$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'] = $post->post_title;
|
|
||||||
|
|
||||||
return parent::get_body();
|
return parent::get_body();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user