'', // Unused. Messages start at index 1. 1 => sprintf( __( 'Property updated. View Property', 'propertyhive' ), esc_url( get_permalink($post_ID) ) ), 2 => __( 'Custom field updated.', 'propertyhive' ), 3 => __( 'Custom field deleted.', 'propertyhive' ), 4 => __( 'Property updated.', 'propertyhive' ), 5 => isset($_GET['revision']) ? sprintf( __( 'Property restored to revision from %s', 'propertyhive' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( __( 'Property published. View Property', 'propertyhive' ), esc_url( get_permalink($post_ID) ) ), 7 => __( 'Property saved.', 'propertyhive' ), 8 => sprintf( __( 'Property submitted. Preview Property', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), 9 => sprintf( __( 'Property scheduled for: %1$s. Preview Property', 'propertyhive' ), date_i18n( __( 'M j, Y @ G:i', 'propertyhive' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), 10 => sprintf( __( 'Property draft updated. Preview Property', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), ); $messages['contact'] = array( 0 => '', // Unused. Messages start at index 1. 1 => __( 'Contact updated.', 'propertyhive' ), 2 => __( 'Custom field updated.', 'propertyhive' ), 3 => __( 'Custom field deleted.', 'propertyhive' ), 4 => __( 'Contact updated.', 'propertyhive' ), 5 => isset($_GET['revision']) ? sprintf( __( 'Contact restored to revision from %s', 'propertyhive' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => __( 'Contact published.', 'propertyhive' ), 7 => __( 'Contact saved.', 'propertyhive' ), 8 => __( 'Contact submitted.', 'propertyhive' ), 9 => sprintf( __( 'Contact scheduled for: %1$s.', 'propertyhive' ), date_i18n( __( 'M j, Y @ G:i', 'propertyhive' ), strtotime( $post->post_date ) )), 10 => __( 'Contact draft updated.', 'propertyhive' ), ); $messages['office'] = array( 0 => '', // Unused. Messages start at index 1. 1 => __( 'Office updated.', 'propertyhive' ), 2 => __( 'Custom field updated.', 'propertyhive' ), 3 => __( 'Custom field deleted.', 'propertyhive' ), 4 => __( 'Office updated.', 'propertyhive' ), 5 => isset($_GET['revision']) ? sprintf( __( 'Office restored to revision from %s', 'propertyhive' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( __( 'Office published.', 'propertyhive' ), esc_url( get_permalink($post_ID) ) ), 7 => __( 'Office saved.', 'propertyhive' ), 8 => sprintf( __( 'Office submitted.', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), 9 => sprintf( __( 'Office scheduled for: %1$s.', 'propertyhive' ), date_i18n( __( 'M j, Y @ G:i', 'propertyhive' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), 10 => sprintf( __( 'Office draft updated. ', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), ); $messages['enquiry'] = array( 0 => '', // Unused. Messages start at index 1. 1 => sprintf( __( 'Enquiry updated.', 'propertyhive' ), esc_url( get_permalink($post_ID) ) ), 2 => __( 'Custom field updated.', 'propertyhive' ), 3 => __( 'Custom field deleted.', 'propertyhive' ), 4 => __( 'Enquiry updated.', 'propertyhive' ), 5 => isset($_GET['revision']) ? sprintf( __( 'Enquiry restored to revision from %s', 'propertyhive' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( __( 'Enquiry published.', 'propertyhive' ), esc_url( get_permalink($post_ID) ) ), 7 => __( 'Enquiry saved.', 'propertyhive' ), 8 => sprintf( __( 'Enquiry submitted.', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), 9 => sprintf( __( 'Enquiry scheduled for: %1$s.', 'propertyhive' ), date_i18n( __( 'M j, Y @ G:i', 'propertyhive' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), 10 => sprintf( __( 'Enquiry draft updated.', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ), ); return $messages; } /** * Remove month filter from some property hive pages */ public function remove_month_filter() { global $typenow; if ($typenow == 'property' || $typenow == 'contact' || $typenow == 'appraisal' || $typenow == 'viewing' || $typenow == 'offer' || $typenow == 'sale') { add_filter('months_dropdown_results', '__return_empty_array'); } } /** * Disable the auto-save functionality for certain CPT's. * * @access public * @return void */ public function disable_autosave(){ /*global $post; if ( $post && get_post_type( $post->ID ) === 'enquiry' ) { wp_dequeue_script( 'autosave' ); }*/ } /** * Filters for post types */ public function restrict_manage_posts() { global $typenow, $wp_query; switch ( $typenow ) { case 'property' : $this->property_filters(); break; case 'contact' : $this->contact_filters(); break; case 'enquiry' : $this->enquiry_filters(); break; case 'appraisal' : $this->appraisal_filters(); break; case 'viewing' : $this->viewing_filters(); break; default : break; } } /** * Show a property filter box */ public function property_filters() { global $wp_query; // Department filtering $output = ''; $output .= $this->property_department_filter(); $output .= $this->property_marketing_filter(); $output .= $this->property_availability_filter(); $output .= $this->property_location_filter(); $output .= $this->property_office_filter(); $output .= $this->property_negotiator_filter(); echo apply_filters( 'propertyhive_property_filters', $output ); } /** * Show a property department filter box */ public function property_department_filter() { global $wp_query; $departments = ph_get_departments(); $selected_department = isset( $_GET['_department'] ) && in_array( $_GET['_department'], array_keys($departments) ) ? $_GET['_department'] : ''; // Department filtering $output = ''; return $output; } /** * Show a property office filter box */ public function property_office_filter() { global $wp_query, $post; // Department filtering $output = ''; return $output; } /** * Show a property negotiator filter box */ public function property_negotiator_filter() { global $wp_query, $post; $selected = ''; if ( isset( $_GET['_negotiator_id'] ) && ! empty( $_GET['_negotiator_id'] ) ) { $selected = (int)$_GET['_negotiator_id']; } $args = array( 'name' => '_negotiator_id', 'id' => 'dropdown_property_negotiator_id', 'show_option_all' => __( 'All Negotiators', 'propertyhive' ), 'selected' => $selected, 'echo' => false, 'role__not_in' => array('property_hive_contact') ); $output = wp_dropdown_users($args); return $output; } /** * Show a property location filter box */ public function property_location_filter() { global $wp_query, $post; // Department filtering $output = ''; return $output; } /** * Show a property availability filter box */ public function property_availability_filter() { global $wp_query, $post; // Availability filtering $output = ''; return $output; } /** * Show a property marketing filter box */ public function property_marketing_filter() { global $wp_query, $post; // Availability filtering $output = ''; return $output; } /** * Show a contact filter box */ public function contact_filters() { global $wp_query; $selected_contact_type = isset( $_GET['_contact_type'] ) && in_array( $_GET['_contact_type'], array( 'owner', 'potentialowner', 'applicant', 'thirdparty' ) ) ? $_GET['_contact_type'] : ''; // Type filtering $options = array(); // Owners $option = '