1. Docs
  2. Add Ons
  3. Property Import
  4. Available Hooks

Available Hooks

There are number of hooks available to use during the import to add custom functionality. Maybe you've got custom fields that you want to import, or perhaps you want to use a different field for the description, for example.

Each format has it's own actions and are in the following format:

propertyhive_pre_import_properties_[format]
Executed: Just before the properties are to be iterated through and imported
Arguments: $properties

propertyhive_property_imported_[format]
Executed: Once per property after it's been imported.
Arguments: $post_id, $property

propertyhive_post_import_properties_[format]
Executed: Just after all properties have been iterated through.
Arguments: none

propertyhive_property_removed_[format]
Executed: After a property has been taken off the market due to it not existing in the import.
Arguments: $post_id

[format] can be replaced with either of the below depending on which format you are using:

- blm
- citylets_xml
- csv
- dezrez_json
- dezrez_xml
- expertagent_xml
- jupix_xml
- thesaurus
- vebra_api_xml
- jet
- rentman_xml
- realla_json

Let's look at a quick example using one of the above hooks:

add_action( 'propertyhive_property_imported_blm', 'email_imported_property', 10, 2);
function email_imported_property( $post_id, $property )
{
    // Note that $property will differ depending on the format
    // A quick way to see what it contains is var_dump($property);

    // Send an email every time a property is received and processed in the import
    // Obviously it's very unlikely you'd want to do this in real life
    mail( 'test@test.com', 'Property imported', 'Property with address ' . $property['DISPLAY_ADDRESS'] . ' was imported with post ID ' . $post_id );
}
Was this article helpful to you? Yes No