Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMPB-1510 Listings imported with IMPress Listings do not include the MLS disclaimer #493

Open
wants to merge 4 commits into
base: release/3.1.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions add-ons/listings/includes/class-listing-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function wp_listings_idx_create_post( $listings ) {

// Load IDX Broker API Class and retrieve featured properties.
$_idx_api = new \IDX\Idx_Api();
$properties = $_idx_api->client_properties( 'featured?disclaimers=true' );
$properties = $_idx_api->client_properties( 'featured' );

// Load WP options.
$wpl_import_options = get_option( 'wp_listings_idx_featured_listing_wp_options' );
Expand Down Expand Up @@ -179,7 +179,7 @@ public static function wp_listings_update_post() {

// Load IDX Broker API Class and retrieve featured properties.
$_idx_api = new \IDX\Idx_Api();
$properties = $_idx_api->client_properties( 'featured?disclaimers=true' );
$properties = $_idx_api->client_properties( 'featured' );

// Load WP options
$idx_featured_listing_wp_options = get_option( 'wp_listings_idx_featured_listing_wp_options' );
Expand Down
4 changes: 2 additions & 2 deletions add-ons/listings/includes/views/single-listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ function single_listing_post_content() {
echo ( get_post_meta( $post->ID, '_listing_featured_on', true ) ) ? '<p class="wp_listings_featured_on">' . esc_html( get_post_meta( $post->ID, '_listing_featured_on', true ) ) . '</p>' : '';

if ( get_post_meta( $post->ID, '_listing_disclaimer', true ) ) {
echo '<p class="wp-listings-disclaimer">' . esc_html( get_post_meta( $post->ID, '_listing_disclaimer', true ) ) . '</p>';
echo '<p class="wp-listings-disclaimer">' . get_post_meta( $post->ID, '_listing_disclaimer', true ) . '</p>';
} elseif ( ! empty( $options['wp_listings_global_disclaimer'] ) ) {
echo '<p class="wp-listings-disclaimer">' . esc_html( $options['wp_listings_global_disclaimer'] ) . '</p>';
echo '<p class="wp-listings-disclaimer">' . $options['wp_listings_global_disclaimer'] . '</p>';
}

if ( class_exists( 'Idx_Broker_Plugin' ) && ! empty( $options['wp_listings_display_idx_link'] ) && get_post_meta( $post->ID, '_listing_details_url', true ) ) {
Expand Down
5 changes: 3 additions & 2 deletions idx/idx-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ public function saved_link_properties_count( $saved_link_id ) {
/**
* Client_properties function.
* Expected $type posibilities: featured, soldpending, supplemental.
*
* Note that ?disclaimers=true will be added to the end of the request, so there's no need to include it in $type
* @access public
* @param string $type
* @return array
Expand Down Expand Up @@ -650,7 +650,8 @@ public function client_properties( $type ) {
continue;
}
// Explode $listing_data['next'] on '/clients/', index 1 of the resulting array will have the fragment needed to make the next API request.
$listing_data = $this->idx_api( explode( '/clients/', $listing_data['next'] )[1], IDX_API_DEFAULT_VERSION, 'clients', array(), 7200, 'GET', true );
// Also add &disclaimers=true to the end of the query as it's not included on the next or prev values
$listing_data = $this->idx_api( explode( '/clients/', $listing_data['next'] )[1] . '&disclaimers=true', IDX_API_DEFAULT_VERSION, 'clients', array(), 7200, 'GET', true );
// If $listing_data['data'] is an array, merge it with the existing listings/properties array.
if ( ! is_wp_error( $listing_data ) && isset( $listing_data['data'] ) && is_array( $listing_data['data'] ) ) {
$properties = array_merge( $properties, $listing_data['data'] );
Expand Down