From 1a12c561305f5fec0cc70a12221ee235265e41ec Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Fri, 6 Dec 2019 10:07:20 +0700 Subject: [PATCH 1/4] Fix description when submit. --- assets/js/frontend/submission.js | 2 +- inc/submission/class-metabox-property-submission.php | 6 ++++++ inc/submission/class-opalestate-submission.php | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/assets/js/frontend/submission.js b/assets/js/frontend/submission.js index 8c54495c..ecdfa7d6 100755 --- a/assets/js/frontend/submission.js +++ b/assets/js/frontend/submission.js @@ -111,7 +111,7 @@ jQuery( document ).ready( function ( $ ) { $submit_btn.parents( 'form' ).on( 'submit', function () { submitFormFiles(); - return false; + // return false; } ); // Clicking Next button diff --git a/inc/submission/class-metabox-property-submission.php b/inc/submission/class-metabox-property-submission.php index 8f544e57..a9ea7cad 100755 --- a/inc/submission/class-metabox-property-submission.php +++ b/inc/submission/class-metabox-property-submission.php @@ -110,6 +110,12 @@ class Opalestate_Property_MetaBox_Submission { 'type' => 'wysiwyg', 'default' => ! empty( $post ) ? $post->post_content : '', 'before_row' => '
', + 'options' => [ + 'media_buttons' => false, + 'dfw' => true, + 'tinymce' => true, + 'quicktags' => true, + ], ], [ 'id' => $prefix . 'price', diff --git a/inc/submission/class-opalestate-submission.php b/inc/submission/class-opalestate-submission.php index 2b30dd37..5500868a 100755 --- a/inc/submission/class-opalestate-submission.php +++ b/inc/submission/class-opalestate-submission.php @@ -547,14 +547,14 @@ class OpalEstate_Submission { ] ); } } else { - return opalestate_output_msg_json( fales, + return opalestate_output_msg_json( false, __( 'Currently, your account was blocked, please keep contact admin to resolve this!.', 'opalestate-pro' ), [ 'heading' => esc_html__( 'Submission Information', 'opalestate-pro' ) ] ); } } - return opalestate_output_msg_json( fales, + return opalestate_output_msg_json( false, __( 'Sorry! Your submitted datcould not save a at this time', 'opalestate-pro' ), [ 'heading' => esc_html__( 'Submission Information', 'opalestate-pro' ) ] ); From 6dfa94d24664f503827650338bde282fe519d4a0 Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Fri, 6 Dec 2019 10:08:22 +0700 Subject: [PATCH 2/4] Tag 1.2.1 --- opal-estate-pro.php | 6 +++--- readme.txt | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/opal-estate-pro.php b/opal-estate-pro.php index 9fed86a9..bd55303e 100755 --- a/opal-estate-pro.php +++ b/opal-estate-pro.php @@ -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 + * Version: 1.2.1 * Author: WPOPAL * Author URI: http://www.wpopal.com * Requires at least: 4.6 @@ -151,7 +151,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' ); + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.2.1' ); } /** @@ -160,7 +160,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { public function setup_constants() { // Plugin version if ( ! defined( 'OPALESTATE_VERSION' ) ) { - define( 'OPALESTATE_VERSION', '1.2' ); + define( 'OPALESTATE_VERSION', '1.2.1' ); } // Plugin Folder Path diff --git a/readme.txt b/readme.txt index 7f2f0d15..955426ac 100755 --- a/readme.txt +++ b/readme.txt @@ -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.2.1 - 2019-12-06 = +* Fixes - Submission property not saved. + = 1.2 - 2019-12-04 = * Fixes - Login ajax. * Added - Enable email settings. From 26a14d2998b04ff7a2ffbffa9297a25662204971 Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Fri, 6 Dec 2019 13:30:11 +0700 Subject: [PATCH 3/4] Add Accumulated listings setting for packages. --- inc/vendors/opalmembership/functions.php | 6 +++++- inc/vendors/opalmembership/membership.php | 23 ++++++++++++++++++----- opal-estate-pro.php | 6 +++--- readme.txt | 3 +++ 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/inc/vendors/opalmembership/functions.php b/inc/vendors/opalmembership/functions.php index bacd369a..3cd2cc00 100755 --- a/inc/vendors/opalmembership/functions.php +++ b/inc/vendors/opalmembership/functions.php @@ -80,7 +80,11 @@ function opalesate_check_package_downgrade_status( $user_id, $package_id ) { 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; } /** diff --git a/inc/vendors/opalmembership/membership.php b/inc/vendors/opalmembership/membership.php index e8f8041c..e9645085 100755 --- a/inc/vendors/opalmembership/membership.php +++ b/inc/vendors/opalmembership/membership.php @@ -246,6 +246,13 @@ class OpalEstate_Membership { '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[] = [ 'name' => esc_html__( 'Enable Expired for properties ', 'opalestate-pro' ), '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_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 ); + $accumulated_listings = get_post_meta( $package_id, OPALMEMBERSHIP_PACKAGES_PREFIX . 'accumulated_listings', true ); $pack_unlimited_listings = $is_unlimited_listings == 'on' ? 0 : 1; @@ -399,12 +407,17 @@ class OpalEstate_Membership { $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 ) - if ( opalesate_check_package_downgrade_status( $user_id, $package_id ) ) { - $new_listings = $pack_listings; - $new_featured_listings = $pack_featured_listings; + 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 { - $new_listings = $pack_listings - $user_current_listings; - $new_featured_listings = $pack_featured_listings - $user_current_featured_listings; + if ( ! opalesate_check_package_downgrade_status( $user_id, $package_id ) ) { + $new_listings = $pack_listings; + $new_featured_listings = $pack_featured_listings; + } else { + $new_listings = $pack_listings - $user_current_listings; + $new_featured_listings = $pack_featured_listings - $user_current_featured_listings; + } } // in case of downgrade diff --git a/opal-estate-pro.php b/opal-estate-pro.php index bd55303e..59598c06 100755 --- a/opal-estate-pro.php +++ b/opal-estate-pro.php @@ -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.1 + * Version: 1.2.2 * Author: WPOPAL * Author URI: http://www.wpopal.com * Requires at least: 4.6 @@ -151,7 +151,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.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() { // Plugin version if ( ! defined( 'OPALESTATE_VERSION' ) ) { - define( 'OPALESTATE_VERSION', '1.2.1' ); + define( 'OPALESTATE_VERSION', '1.2.2' ); } // Plugin Folder Path diff --git a/readme.txt b/readme.txt index 955426ac..4fc0b608 100755 --- a/readme.txt +++ b/readme.txt @@ -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.2.2 - 2019-12-06 = +* Added - Add Accumulated listings setting for packages. + = 1.2.1 - 2019-12-06 = * Fixes - Submission property not saved. From 9c9670155afb17e8904e12b6661400a22ba14e50 Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Fri, 6 Dec 2019 14:10:12 +0700 Subject: [PATCH 4/4] Fix Description submission. --- assets/js/frontend/submission.js | 10 +++++++--- inc/submission/class-opalestate-submission.php | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/assets/js/frontend/submission.js b/assets/js/frontend/submission.js index ecdfa7d6..9963f124 100755 --- a/assets/js/frontend/submission.js +++ b/assets/js/frontend/submission.js @@ -42,9 +42,12 @@ jQuery( document ).ready( function ( $ ) { }); */ var submitFormFiles = function ( name, files ) { + if( typeof(tinyMCE) != "undefined" ) { + tinyMCE.triggerSave(); + } + var formData = new FormData(); formData.append( 'section', 'general' ); - // formData.append('action', 'opalestate_submitted_property'); $( '.cmb2-uploader-files' ).each( function () { var file_btn = $( 'input.select-file', this ); @@ -72,6 +75,7 @@ jQuery( document ).ready( function ( $ ) { } ); formData.append( 'action', 'opalestate_save_agency_data' ); + toggleSubmit( $submit_btn ); $.ajax( { url: opalesateJS.ajaxurl, @@ -109,9 +113,9 @@ jQuery( document ).ready( function ( $ ) { } ); }; - $submit_btn.parents( 'form' ).on( 'submit', function () { + $submit_btn.parents( 'form' ).on( 'submit', function (e) { submitFormFiles(); - // return false; + return false; } ); // Clicking Next button diff --git a/inc/submission/class-opalestate-submission.php b/inc/submission/class-opalestate-submission.php index 5500868a..05c26861 100755 --- a/inc/submission/class-opalestate-submission.php +++ b/inc/submission/class-opalestate-submission.php @@ -499,8 +499,10 @@ class OpalEstate_Submission { $featured_image = get_post_meta( $post_id, $prefix . 'featured_image', true ); if ( ! empty( $_POST[ $prefix . 'featured_image' ] ) && isset( $_POST[ $prefix . 'featured_image' ] ) ) { - foreach ( $_POST[ $prefix . 'featured_image' ] as $key => $value ) { - set_post_thumbnail( $post_id, $key ); + if ( $_POST[ $prefix . 'featured_image' ] && is_array( $_POST[ $prefix . 'featured_image' ] ) ) { + foreach ( $_POST[ $prefix . 'featured_image' ] as $key => $value ) { + set_post_thumbnail( $post_id, $key ); + } } unset( $_POST[ $prefix . 'featured_image' ] ); } else {