Hotfix: Fix email approved.
This commit is contained in:
parent
46378081f5
commit
a82811aad9
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user