diff --git a/inc/agency/class-opalestate-agency-front.php b/inc/agency/class-opalestate-agency-front.php index 6138ce11..e969d2d0 100755 --- a/inc/agency/class-opalestate-agency-front.php +++ b/inc/agency/class-opalestate-agency-front.php @@ -124,7 +124,6 @@ class Opalestate_Agency_Front { * */ private function update_data_agent_or_agency( $prefix ) { - global $current_user; $post_id = isset( $_POST['object_id'] ) && absint( $_POST['object_id'] ) ? $_POST['object_id'] : 0; @@ -154,7 +153,8 @@ class Opalestate_Agency_Front { unset( $_POST[ $prefix . 'text' ] ); if ( $data['ID'] > 0 ) { - $post_id = wp_update_post( $data, true ); + $data['post_status'] = 'publish'; + $post_id = wp_update_post( $data, true ); } else { $data['post_status'] = 'pending'; $post_id = wp_insert_post( $data, true ); @@ -275,12 +275,9 @@ class Opalestate_Agency_Front { } public function on_save_front_data() { - if ( isset( $_POST[ 'nonce_CMB2php' . OPALESTATE_AGENCY_PREFIX . 'front' ] ) ) { - $post_id = isset( $_POST['object_id'] ) && $_POST['object_id'] ? absint( $_POST['object_id'] ) : 0; - - $post = get_post( $post_id ); + $post = get_post( $post_id ); $post_id = $this->update_data_agent_or_agency( OPALESTATE_AGENCY_PREFIX ); @@ -368,7 +365,7 @@ class Opalestate_Agency_Front { $post = get_post( $post_id ); if ( isset( $post->ID ) && ( $post->post_status != 'publish' || $post->ID == get_the_ID() ) ) { - opalestate_add_notice( 'warning', esc_html__( 'You account is under reviewing! It take some time to process.', 'opalestate-pro' ) ); + opalestate_add_notice( 'warning', esc_html__( 'You need to enter some required information to publish your account.', 'opalestate-pro' ) ); add_action( 'opalestate_profile_agency_form_before', 'opalestate_print_notices' ); } @@ -516,7 +513,6 @@ class Opalestate_Agency_Front { 'post_author' => $user_id, ], true ); - do_action( 'opalesate_insert_user_agency', $agency_id ); return $agency_id; diff --git a/inc/agent/class-opalestate-agent-front.php b/inc/agent/class-opalestate-agent-front.php index e7b129e4..76f8a3bb 100755 --- a/inc/agent/class-opalestate-agent-front.php +++ b/inc/agent/class-opalestate-agent-front.php @@ -102,7 +102,7 @@ class Opalestate_Agent_Front { $post = get_post( $post_id ); if ( isset( $post->ID ) && ( $post->post_status != 'publish' || $post->ID == get_the_ID() ) ) { - opalestate_add_notice( 'warning', esc_html__( 'You account is under reviewing! It take some time to process.', 'opalestate-pro' ) ); + opalestate_add_notice( 'warning', esc_html__( 'You need to enter some required information to publish your account.', 'opalestate-pro' ) ); add_action( 'opalestate_profile_agent_form_before', 'opalestate_print_notices' ); } @@ -191,9 +191,7 @@ class Opalestate_Agent_Front { } public function on_save_front_data() { - if ( isset( $_POST[ 'nonce_CMB2php' . OPALESTATE_AGENT_PREFIX . 'front' ] ) ) { - $post_id = $this->update_data_agent_or_agency( OPALESTATE_AGENT_PREFIX ); if ( $post_id ) { @@ -254,13 +252,12 @@ class Opalestate_Agent_Front { 'post_content' => wp_kses( $_POST[ $prefix . 'text' ], '

' ), ]; - unset( $_POST[ $prefix . 'title' ] ); unset( $_POST[ $prefix . 'text' ] ); - if ( $data['ID'] > 0 ) { - $post_id = wp_update_post( $data, true ); + $data['post_status'] = 'publish'; + $post_id = wp_update_post( $data, true ); } else { $data['post_status'] = 'pending'; $post_id = wp_insert_post( $data, true ); @@ -307,9 +304,7 @@ class Opalestate_Agent_Front { } public function register_shortcodes() { - $this->shortcodes = [ - 'change_agent_profile' => [ 'code' => 'change_agent_profile', 'label' => esc_html__( 'Agent Profile', 'opalestate-pro' ) ], 'search_agents' => [ 'code' => 'search_agents', 'label' => esc_html__( 'Search Agents', 'opalestate-pro' ) ], 'agent_carousel' => [ 'code' => 'agent_carousel', 'label' => esc_html__( 'Agent Carousel', 'opalestate-pro' ) ], @@ -318,11 +313,9 @@ class Opalestate_Agent_Front { foreach ( $this->shortcodes as $shortcode ) { add_shortcode( 'opalestate_' . $shortcode['code'], [ $this, $shortcode['code'] ] ); } - } public function agent_carousel( $atts ) { - $atts = is_array( $atts ) ? $atts : []; $layout = 'search-agency-form'; @@ -341,9 +334,7 @@ class Opalestate_Agent_Front { } public function archives_query( $query ) { - if ( $query->is_main_query() && is_post_type_archive( 'opalestate_agent' ) ) { - $args = []; $min = opalestate_options( 'search_agent_min_price', 0 ); @@ -368,7 +359,6 @@ class Opalestate_Agent_Front { $tax_query = []; - if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) { $tax_query[] = [ @@ -411,7 +401,6 @@ class Opalestate_Agent_Front { ] ); } - ///// search by address and geo location /// if ( isset( $_GET['geo_long'] ) && isset( $_GET['geo_lat'] ) ) { diff --git a/templates/user/agent/profile-agent.php b/templates/user/agent/profile-agent.php index 8387ac3f..8fefb6d1 100755 --- a/templates/user/agent/profile-agent.php +++ b/templates/user/agent/profile-agent.php @@ -1,7 +1,5 @@

-
-

@@ -11,7 +9,7 @@ if ( function_exists( 'cmb2_get_metabox_form' ) ) { echo cmb2_get_metabox_form( $metaboxes[ OPALESTATE_AGENT_PREFIX . 'front' ], $post_id, [ - 'form_format' => '
%3$s
', + 'form_format' => '
%3$s
', 'save_button' => esc_html__( 'Save Change', 'opalestate-pro' ), ] ); }