Add Accumulated listings setting for packages.
This commit is contained in:
parent
6dfa94d246
commit
26a14d2998
6
inc/vendors/opalmembership/functions.php
vendored
6
inc/vendors/opalmembership/functions.php
vendored
@ -80,7 +80,11 @@ function opalesate_check_package_downgrade_status( $user_id, $package_id ) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( $user_current_listings > $pack_listings ) || ( $user_current_featured_listings > $pack_featured_listings );
|
if ( $user_current_listings > $pack_listings ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
15
inc/vendors/opalmembership/membership.php
vendored
15
inc/vendors/opalmembership/membership.php
vendored
@ -246,6 +246,13 @@ class OpalEstate_Membership {
|
|||||||
'description' => esc_html__( 'Number of properties can make featured with this package.', 'opalestate-pro' ),
|
'description' => esc_html__( 'Number of properties can make featured with this package.', 'opalestate-pro' ),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$fields[] = [
|
||||||
|
'name' => esc_html__( 'Accumulated listings?', 'opalestate-pro' ),
|
||||||
|
'id' => $prefix . 'accumulated_listings',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'description' => esc_html__( 'Increase Number Of Properties and Number Of Featured Properties from current remaining values when upgrading this package.', 'opalestate-pro' ),
|
||||||
|
];
|
||||||
|
|
||||||
$fields[] = [
|
$fields[] = [
|
||||||
'name' => esc_html__( 'Enable Expired for properties ', 'opalestate-pro' ),
|
'name' => esc_html__( 'Enable Expired for properties ', 'opalestate-pro' ),
|
||||||
'id' => $prefix . 'enable_property_expired',
|
'id' => $prefix . 'enable_property_expired',
|
||||||
@ -386,6 +393,7 @@ class OpalEstate_Membership {
|
|||||||
$pack_listings = get_post_meta( $package_id, OPALMEMBERSHIP_PACKAGES_PREFIX . 'package_listings', true );
|
$pack_listings = get_post_meta( $package_id, OPALMEMBERSHIP_PACKAGES_PREFIX . 'package_listings', true );
|
||||||
$pack_featured_listings = get_post_meta( $package_id, OPALMEMBERSHIP_PACKAGES_PREFIX . 'package_featured_listings', true );
|
$pack_featured_listings = get_post_meta( $package_id, OPALMEMBERSHIP_PACKAGES_PREFIX . 'package_featured_listings', true );
|
||||||
$is_unlimited_listings = get_post_meta( $package_id, OPALMEMBERSHIP_PACKAGES_PREFIX . 'unlimited_listings', true );
|
$is_unlimited_listings = get_post_meta( $package_id, OPALMEMBERSHIP_PACKAGES_PREFIX . 'unlimited_listings', true );
|
||||||
|
$accumulated_listings = get_post_meta( $package_id, OPALMEMBERSHIP_PACKAGES_PREFIX . 'accumulated_listings', true );
|
||||||
|
|
||||||
$pack_unlimited_listings = $is_unlimited_listings == 'on' ? 0 : 1;
|
$pack_unlimited_listings = $is_unlimited_listings == 'on' ? 0 : 1;
|
||||||
|
|
||||||
@ -399,13 +407,18 @@ class OpalEstate_Membership {
|
|||||||
$user_current_listings = opalesate_get_user_current_listings( $user_id ); // get user current listings ( no expired )
|
$user_current_listings = opalesate_get_user_current_listings( $user_id ); // get user current listings ( no expired )
|
||||||
$user_current_featured_listings = opalesate_get_user_current_featured_listings( $user_id ); // get user current featured listings ( no expired )
|
$user_current_featured_listings = opalesate_get_user_current_featured_listings( $user_id ); // get user current featured listings ( no expired )
|
||||||
|
|
||||||
if ( opalesate_check_package_downgrade_status( $user_id, $package_id ) ) {
|
if ( $accumulated_listings == 'on') {
|
||||||
|
$new_listings = ( $current_listings != -1 ) ? ( $pack_listings + $current_listings ) : $pack_listings;
|
||||||
|
$new_featured_listings = ( $curent_featured_listings != -1 ) ? ( $pack_featured_listings + $curent_featured_listings ) : $pack_featured_listings;
|
||||||
|
} else {
|
||||||
|
if ( ! opalesate_check_package_downgrade_status( $user_id, $package_id ) ) {
|
||||||
$new_listings = $pack_listings;
|
$new_listings = $pack_listings;
|
||||||
$new_featured_listings = $pack_featured_listings;
|
$new_featured_listings = $pack_featured_listings;
|
||||||
} else {
|
} else {
|
||||||
$new_listings = $pack_listings - $user_current_listings;
|
$new_listings = $pack_listings - $user_current_listings;
|
||||||
$new_featured_listings = $pack_featured_listings - $user_current_featured_listings;
|
$new_featured_listings = $pack_featured_listings - $user_current_featured_listings;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// in case of downgrade
|
// in case of downgrade
|
||||||
if ( $new_listings < 0 ) {
|
if ( $new_listings < 0 ) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: Opal Estate Pro
|
* Plugin Name: Opal Estate Pro
|
||||||
* Plugin URI: https://wpdocs.gitbook.io/opal-estate/
|
* 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.
|
* Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website.
|
||||||
* Version: 1.2.1
|
* Version: 1.2.2
|
||||||
* Author: WPOPAL
|
* Author: WPOPAL
|
||||||
* Author URI: http://www.wpopal.com
|
* Author URI: http://www.wpopal.com
|
||||||
* Requires at least: 4.6
|
* Requires at least: 4.6
|
||||||
@ -151,7 +151,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
|
|||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
// Cloning instances of the class is forbidden
|
// Cloning instances of the class is forbidden
|
||||||
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.2.1' );
|
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.2.2' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,7 +160,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
|
|||||||
public function setup_constants() {
|
public function setup_constants() {
|
||||||
// Plugin version
|
// Plugin version
|
||||||
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
|
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
|
||||||
define( 'OPALESTATE_VERSION', '1.2.1' );
|
define( 'OPALESTATE_VERSION', '1.2.2' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin Folder Path
|
// Plugin Folder Path
|
||||||
|
@ -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")
|
* System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page")
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
= 1.2.2 - 2019-12-06 =
|
||||||
|
* Added - Add Accumulated listings setting for packages.
|
||||||
|
|
||||||
= 1.2.1 - 2019-12-06 =
|
= 1.2.1 - 2019-12-06 =
|
||||||
* Fixes - Submission property not saved.
|
* Fixes - Submission property not saved.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user