Add expiry date column

This commit is contained in:
Hoang Huu 2020-02-10 10:33:37 +07:00
parent dd9163a00f
commit 50c6d4d421
5 changed files with 30 additions and 7 deletions

@ -1,3 +1,6 @@
= 1.3 - 2020-02-10 =
* Added - Expiry date column.
= 1.2.9.4 - 2020-02-05 =
* Fixes - Login with Edior role.

@ -38,12 +38,12 @@ class Opalestate_Admin_Property {
// add_action( 'transition_post_status', array( __CLASS__, 'save_post' ), 10, 3 );
}
/**
*
*/
public static function save_post( $new_status, $old_status, $post ){
if ( $new_status == 'publish' && $post->post_type == "opalestate_property" ) {
public static function save_post( $new_status, $old_status, $post ) {
if ( $new_status == 'publish' && $post->post_type == "opalestate_property" ) {
$user_id = $post->post_author;
$user = get_user_by( 'id', $user_id );
if ( ! is_object( $user ) ) {
@ -103,6 +103,7 @@ class Opalestate_Admin_Property {
$columns['comments'] = $comments;
$columns['author'] = esc_html__( 'Author', 'opalestate-pro' );
$columns['date'] = esc_html__( 'Date', 'opalestate-pro' );
$columns['expiry_date'] = esc_html__( 'Expiry Date', 'opalestate-pro' );
return $columns;
}
@ -148,6 +149,15 @@ class Opalestate_Admin_Property {
}
break;
case 'expiry_date':
if ( $property->get_expiry_date() ) {
$expired_time = $property->get_expiry_date();
echo date_i18n( __( 'Y/m/d g:i:s a', 'opalestate-pro' ), $expired_time );
} else {
echo esc_html_x( '---', 'expired property', 'opalestate-pro' );
}
break;
default:
# code...
break;

@ -740,4 +740,11 @@ class Opalestate_Property {
public function get_posted() {
return human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) . ' ' . esc_html__( 'ago' );
}
public function get_expiry_date() {
$expired_activated = get_post_meta( $this->get_id(), OPALESTATE_PROPERTY_PREFIX . 'expired_activated', true );
$expired_time = get_post_meta( $this->get_id(), OPALESTATE_PROPERTY_PREFIX . 'expired_time', true );
return ( $expired_activated && $expired_time ) ? $expired_time : '';
}
}

@ -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.9.4
* Version: 1.3
* 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’ huh?', 'opalestate-pro' ), '1.2.9.4' );
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.3' );
}
/**
@ -159,7 +159,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() {
// Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.2.9.4' );
define( 'OPALESTATE_VERSION', '1.3' );
}
// Plugin Folder Path

@ -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.2.9.4
Stable tag: 1.3
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 - 2020-02-10 =
* Added - Expiry date column.
= 1.2.9.4 - 2020-02-05 =
* Fixes - Login with Edior role.