• Resolved miclovin

    (@miclovin)


    FYI, I am posting some feedback from another developer about how to resolve plugin conflicts with wp-property.

    Could you get in touch with WP Property plugin developers and ask them if ud_get_wp_property can be called only on plugin respective pages instead of on entire WP admin and that should hopefully fix the issue?

    I hope you guys can make this change soon so that WP-Property works better with other plugins.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor MariaKravchenko

    (@mariakravchenko)

    Hello.

    Thank you for the feedback. We will check that.

    Regards.

    Plugin Contributor MariaKravchenko

    (@mariakravchenko)

    We need to know where particular that function is causing the issue to get rid of it in that particular place if possible.

    Regards.

    Thread Starter miclovin

    (@miclovin)

    The entire WP admin.

    Hello @mariakravchenko,

    Our developer prepared code that needs to be changed in WP Property plugin and list of the files to change, so it will stop conflicting with other plugins:

    // #############################################
    // \wp-property\lib\class_core.php
    // Line 527
    
    //From:
    function admin_body_class( $content ) {
    	global $current_screen;
    
    	if( $current_screen->id == 'edit-property' ) {
    		return 'wp-list-table ';
    	}
    
    	if( $current_screen->id == 'property' ) {
    		return 'wpp_property_edit';
    	}
    }
    
    // To:
    function admin_body_class( $content ) {
    	global $current_screen;
    
    	if( $current_screen->id == 'edit-property' ) {
    		$content .= ' wp-list-table ';
    	}
    
    	if( $current_screen->id == 'property' ) {
    		$content .= ' wpp_property_edit ';
    	}
    
    	return $content;
    }
    
    // #############################################
    // \wp-property\lib\classes\class-admin.php
    // Line 164
    
    // From:
    public function admin_body_class() {
    	global $current_screen, $wp_properties;
    
    	// Do nothing.
    	if( !isset( $current_screen->base ) || !isset( $current_screen->post_type ) || !isset( $current_screen->taxonomy ) || $current_screen->post_type !== 'property' ) {
    		return;
    	}
    
    	// When developer mode is enabeld, allow editing.
    	if( isset( $wp_properties['configuration'] ) && isset( $wp_properties['configuration']['developer_mode'] ) && $wp_properties['configuration']['developer_mode'] === 'true' ) {
    		return;
    	}
    
    	$_readonly_taxonomies = array();
    
    	foreach( $wp_properties['taxonomies'] as $_tax => $_tax_detail ) {
    
    		if( isset( $_tax_detail['readonly'] ) && ( $_tax_detail['readonly'] === 'true' || $_tax_detail['readonly'] == 1 || $_tax_detail['readonly'] === '1' ) ) {
    			$_readonly_taxonomies[] = $_tax;
    		}
    	}
    
    	// Hide term editing UI.
    	if( $current_screen->base === 'edit-tags' && in_array($current_screen->taxonomy, $_readonly_taxonomies ) ) {
    		return 'wpp-disable-term-editing wpp-readonly-taxonomy';
    	}
    
    }
    
    // To:
    public function admin_body_class( $classes ) {
    	global $current_screen, $wp_properties;
    
    	// Do nothing.
    	if( !isset( $current_screen->base ) || !isset( $current_screen->post_type ) || !isset( $current_screen->taxonomy ) || $current_screen->post_type !== 'property' ) {
    		return $classes;
    	}
    
    	// When developer mode is enabeld, allow editing.
    	if( isset( $wp_properties['configuration'] ) && isset( $wp_properties['configuration']['developer_mode'] ) && $wp_properties['configuration']['developer_mode'] === 'true' ) {
    		return $classes;
    	}
    
    	$_readonly_taxonomies = array();
    
    	foreach( $wp_properties['taxonomies'] as $_tax => $_tax_detail ) {
    
    		if( isset( $_tax_detail['readonly'] ) && ( $_tax_detail['readonly'] === 'true' || $_tax_detail['readonly'] == 1 || $_tax_detail['readonly'] === '1' ) ) {
    			$_readonly_taxonomies[] = $_tax;
    		}
    	}
    
    	// Hide term editing UI.
    	if( $current_screen->base === 'edit-tags' && in_array($current_screen->taxonomy, $_readonly_taxonomies ) ) {
    		return $classes .= ' wpp-disable-term-editing wpp-readonly-taxonomy ';
    	}
    
    }
    
    // #############################################
    // \wp-property-importer\lib\class-wpp-property-import.php
    // Line 527
    
    // From:
    static public function admin_body_class( $id ) {
    	global $current_screen, $post;
    
    	if( $current_screen->id == 'property' ) {
    
    		$wpp_import_schedule_id = get_post_meta( $post->ID, 'wpp_import_schedule_id', true );
    
    		if( $wpp_import_schedule_id ) {
    			return 'wpp_property_edit wpp_imported_property';
    		} else {
    			return 'wpp_property_edit';
    		}
    
    	}
    
    }
    
    // To:
    
    static public function admin_body_class( $classes ) {
    	global $current_screen, $post;
    
    	if( $current_screen->id == 'property' ) {
    
    	$wpp_import_schedule_id = get_post_meta( $post->ID, 'wpp_import_schedule_id', true );
    
    		if( $wpp_import_schedule_id ) {
    			return $classes .= ' wpp_property_edit wpp_imported_property ';
    		} else {
    			return $classes .= ' wpp_property_edit ';
    		}
    
    	}
    
    	return $classes;
    }

    You can easily spot differences. Your plugin do return 'wpp_property_edit'; so it returns only its class. But you should do return $classes .= ' wpp_property_edit '; to append it’s classes instead if needed.

    Let us know if you have more questions.

    kind regards,
    Kasia

    Plugin Contributor MariaKravchenko

    (@mariakravchenko)

    Thanks for details. I will check with our developer.

    Thread Starter miclovin

    (@miclovin)

    Wow, thank you both!

    Plugin Contributor MariaKravchenko

    (@mariakravchenko)

    Hello.

    WP-Property release with the mentioned fix was done.

    Thanks all.
    Regards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Plugin Conflicts’ is closed to new replies.