Fixes. Add mortgage single setting. Tag 1.5.1

This commit is contained in:
Hoang Huu 2020-06-01 13:31:23 +07:00
parent 3b24e7c6d2
commit c6a75c3b49
8 changed files with 84 additions and 28 deletions

View File

@ -1,3 +1,6 @@
= 1.5.1 - 2020-06-01 =
* Added - Enable/Disable setting for each property.
= 1.5 - 2020-05-29 =
* Added - Search properties in admin by SKU & Address.

View File

@ -500,6 +500,17 @@ class Opalestate_Property_MetaBox {
'options' => $templates,
'description' => esc_html__( 'Select a layout to display full information of this property', 'opalestate-pro' ),
],
[
'name' => esc_html__( 'Show Mortgage Calculator', 'opalestate-pro' ),
'id' => "{$prefix}enable_single_mortgage",
'type' => 'select',
'options' => [
'' => esc_html__( 'Inherit', 'opalestate-pro' ),
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'description' => esc_html__( 'Show Mortgage Calculator', 'opalestate-pro' ),
],
];
return apply_filters( 'opalestate_postype_property_metaboxes_fields_layout', $fields );

View File

@ -40,14 +40,19 @@ function opalestate_single_property_layout_default() {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v2', 5 );
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form', 6 );
if ( opalestate_get_option( 'enable_single_mortgage', 'on' ) == 'on' ) {
$single_mortgage = get_post_meta( get_the_ID(), OPALESTATE_PROPERTY_PREFIX . 'enable_single_mortgage', true );
if ( $single_mortgage === 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
} elseif ( $single_mortgage === '' ) {
if ( opalestate_get_option( 'enable_single_mortgage', 'on' ) == 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
}
}
add_filter( 'opalestate_thumbnail_nav_column', function () {
return 6;
} );
}
@ -74,8 +79,14 @@ function opalestate_single_property_layout_v2() {
add_action( 'opalestate_after_single_property_summary_v2', 'opalestate_property_map_v2', 5 );
if ( opalestate_get_option( 'enable_single_mortgage', 'on' ) == 'on' ) {
$single_mortgage = get_post_meta( get_the_ID(), OPALESTATE_PROPERTY_PREFIX . 'enable_single_mortgage', true );
if ( $single_mortgage === 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
} elseif ( $single_mortgage === '' ) {
if ( opalestate_get_option( 'enable_single_mortgage', 'on' ) == 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
}
}
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v3', 10 );
@ -112,8 +123,14 @@ function opalestate_single_property_layout_v3() {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v2', 5 );
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form', 6 );
if ( opalestate_get_option( 'enable_single_mortgage' , 'on' ) == 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage' );
$single_mortgage = get_post_meta( get_the_ID(), OPALESTATE_PROPERTY_PREFIX . 'enable_single_mortgage', true );
if ( $single_mortgage === 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
} elseif ( $single_mortgage === '' ) {
if ( opalestate_get_option( 'enable_single_mortgage', 'on' ) == 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
}
}
}
@ -148,8 +165,14 @@ function opalestate_single_property_layout_v4() {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v2', 5 );
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form', 6 );
if ( opalestate_get_option( 'enable_single_mortgage' , 'on' ) == 'on' ) {
$single_mortgage = get_post_meta( get_the_ID(), OPALESTATE_PROPERTY_PREFIX . 'enable_single_mortgage', true );
if ( $single_mortgage === 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
} elseif ( $single_mortgage === '' ) {
if ( opalestate_get_option( 'enable_single_mortgage', 'on' ) == 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
}
}
}
@ -190,8 +213,14 @@ function opalestate_single_property_layout_v5() {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v2', 5 );
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form', 6 );
if ( opalestate_get_option( 'enable_single_mortgage' ,'on' ) == 'on' ) {
$single_mortgage = get_post_meta( get_the_ID(), OPALESTATE_PROPERTY_PREFIX . 'enable_single_mortgage', true );
if ( $single_mortgage === 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
} elseif ( $single_mortgage === '' ) {
if ( opalestate_get_option( 'enable_single_mortgage', 'on' ) == 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
}
}
}
@ -336,19 +365,20 @@ add_action( 'opalestate_before_property_loop_item', 'opalestate_property_label'
*/
function opalestate_single_property_sidebar_widgets() {
if ( is_active_sidebar( 'opalestate-single-property' ) ) : ?>
<div class="opalestate-single-property-widgets">
<div class="opalestate-single-property-widgets">
<?php dynamic_sidebar( 'opalestate-single-property' ); ?>
</div>
</div>
<?php endif;
}
add_action( 'opalestate_single_property_sidebar', 'opalestate_single_property_sidebar_widgets', 99 );
function opalestate_hide_unset_amenities( $show ) {
if ( 'off' === opalestate_get_option( 'hide_unset_amenities', 'off' ) ) {
return false;
}
if ( 'off' === opalestate_get_option( 'hide_unset_amenities', 'off' ) ) {
return false;
}
return true;
return true;
}
add_filter( 'opalestate_hide_unset_amenity', 'opalestate_hide_unset_amenities' );

View File

@ -33,7 +33,6 @@ function opalestate_submssion_list_page( $args = [] ) {
}
function opalestate_get_user_management_page_uri( $args = [] ) {
global $opalestate_options;
$uri = isset( $opalestate_options['user_management_page'] ) ? get_permalink( absint( $opalestate_options['user_management_page'] ) ) : get_bloginfo( 'url' );
@ -50,6 +49,14 @@ function opalestate_get_user_management_page_uri( $args = [] ) {
return apply_filters( 'opalestate_user_management_page_uri', $uri );
}
function opalestate_is_user_management_page() {
global $opalestate_options;
$page_id = isset( $opalestate_options['user_management_page'] ) ? ( absint( $opalestate_options['user_management_page'] ) ) : 0;
return $page_id && is_page( $page_id );
}
function opalestate_get_current_url( $args = [] ) {
global $wp;
if ( isset( $_GET['tab'] ) && $_GET['tab'] ) {
@ -162,12 +169,14 @@ function opalestate_management_user_menu_tabs() {
foreach ( $menu as $key => $item ) {
if ( preg_match( "#http#", $item['link'] ) ) {
$link = $item['link'];
$link = $item['link'];
$is_active = is_page( $item['id'] ) ? ' active' : '';
} else {
$link = $uri . '?tab=' . $item['link'];
$link = $uri . '?tab=' . $item['link'];
$is_active = isset( $_GET['tab'] ) && $current_tab == $item['link'] ? ' active' : '';
}
$output .= '<li class="account-links-item ' . $key . ( $current_tab == $item['link'] ? ' active' : '' ) . '"><a href="' . $link . '"><i class="' . $item['icon'] . '"></i> ' . $item['title'] . '</a></li>';
$output .= '<li class="account-links-item ' . $key . $is_active . '"><a href="' . $link . '"><i class="' . $item['icon'] . '"></i> ' . $item['title'] . '</a></li>';
}
$output .= '<li><a href="' . wp_logout_url( home_url( '/' ) ) . '"> <i class="fa fa-unlock"></i> ' . esc_html__( 'Log out', 'opalestate-pro' ) . '</a></li>';
@ -211,7 +220,7 @@ function opalestate_get_user_dashboard_menus() {
'icon' => 'far fa-star',
'link' => 'reviews',
'title' => esc_html__( 'Reviews', 'opalestate-pro' ),
'id' => isset( $opalestate_options['reviews_page'] ) ? $opalestate_options['reviews_page'] : 0,
'id' => isset( $opalestate_options['profile_page'] ) ? $opalestate_options['profile_page'] : 0,
];
}
@ -220,7 +229,7 @@ function opalestate_get_user_dashboard_menus() {
'icon' => 'fa fa-envelope',
'link' => 'messages',
'title' => esc_html__( 'Messages', 'opalestate-pro' ),
'id' => isset( $opalestate_options['reviews_page'] ) ? $opalestate_options['reviews_page'] : 0,
'id' => isset( $opalestate_options['profile_page'] ) ? $opalestate_options['profile_page'] : 0,
];
}
@ -346,8 +355,8 @@ function opalestate_current_user_can_access_dashboard_page( $page = '' ) {
* @return bool
*/
function opalestate_user_has_estate_roles( $user_id ) {
$user_meta = get_userdata( $user_id );
$roles = $user_meta->roles;
$user_meta = get_userdata( $user_id );
$roles = $user_meta->roles;
$allowd_roles = opalestate_get_allowed_roles();
foreach ( $roles as $role ) {

View File

@ -305,7 +305,7 @@ class OpalEstate_Membership {
'icon' => 'fa fa-user',
'link' => opalmembership_get_payment_history_page_uri(),
'title' => esc_html__( 'My Invoices', 'opalestate-pro' ),
'id' => isset( $opalmembership_options['dashboard_page'] ) ? $opalmembership_options['dashboard_page'] : 0,
'id' => isset( $opalmembership_options['history_page'] ) ? $opalmembership_options['history_page'] : 0,
];
}
@ -314,7 +314,7 @@ class OpalEstate_Membership {
'icon' => 'fa fa-certificate',
'link' => opalmembership_get_membership_page_uri(),
'title' => esc_html__( 'Renew membership', 'opalestate-pro' ),
'id' => isset( $opalmembership_options['dashboard_page'] ) ? $opalmembership_options['dashboard_page'] : 0,
'id' => isset( $opalmembership_options['membership_page'] ) ? $opalmembership_options['membership_page'] : 0,
];
}
}

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.5
* Version: 1.5.1
* 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&#8217; huh?', 'opalestate-pro' ), '1.5' );
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.5.1' );
}
/**
@ -159,7 +159,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() {
// Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.5' );
define( 'OPALESTATE_VERSION', '1.5.1' );
}
// 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.9
Tested up to: 5.3.2
Stable tag: 1.4.9.5
Stable tag: 1.5.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -152,6 +152,9 @@ This section describes how to install the plugin and get it working.
* System tickets support 24/7 available : [free support](https://themelexus.ticksy.com/ "Visit the Plugin support Page")
== Changelog ==
= 1.5.1 - 2020-06-01 =
* Added - Enable/Disable setting for each property.
= 1.5 - 2020-05-29 =
* Added - Search properties in admin by SKU & Address.

View File

@ -113,7 +113,7 @@ $roles_classes = implode( ' ', array_map( 'sanitize_html_class', $roles ) )
<div class="content-area" id="primary">
<?php $tab = isset( $_GET['tab'] ) && $_GET['tab'] ? sanitize_text_field( $_GET['tab'] ) : 'dashboard'; ?>
<div class="site-main" id="main" role="main">
<?php if ( $tab ) : ?>
<?php if ( $tab && opalestate_is_user_management_page() ) : ?>
<?php opalestate_management_show_content_page_tab(); ?>
<?php else : ?>
<?php while ( have_posts() ) : the_post(); ?>