The "Agents/Employees" add-on runs a daily scheduled event that fires a function called "impress_agents_update_post", this function collects all the imported "Employees (Agents)" that are fetched from the IDXBroker API using the IMPress Agent import functionality and updates the posts meta if new data is returned from the IDXBroker API.
As is, the function does nothing due to two bugs:
The function that collects all the post ID's adds the agentID / post ID's pair in a numeric array, but then tries to match them with the API response data as if they were added in an associative array. To fix this I changed the way ID's are added to the array.
The ID's are then pushed to a function called "impress_agents_idx_insert_post_meta" that is supposed to update the the posts meta fields if they are empty, however that function incorrectly checks if the meta values are empty. get_post_meta by default returns an array (even if no meta value is present it will return an empty array) so it will never return empty value, to fix this I've added "true" as the third parameter of all instances of "get_post_meta" in that function, that way get_post_meta returns the field value.
Verification Process
You can reproduce the bug by importing agents from IDXBroker, add new data in the agents profile and execute the scheduled event "impress_agents_idx_update", it will not do anything.
With this change meta field values are updated with the new user data added in the IDXBroker dashboard.
The only other function that is using the "impress_agents_idx_insert_post_meta" is the agent import process, I tried importing agents on a fresh install and there are no issues with this change.
Release Notes
Fix: User data sync for imported agents.
Review
Pull Requests must have the sign-off of two other developers and at least one of these must be an IDX Broker team member.
Description of the Change
The "Agents/Employees" add-on runs a daily scheduled event that fires a function called "impress_agents_update_post", this function collects all the imported "Employees (Agents)" that are fetched from the IDXBroker API using the IMPress Agent import functionality and updates the posts meta if new data is returned from the IDXBroker API.
As is, the function does nothing due to two bugs:
Verification Process
You can reproduce the bug by importing agents from IDXBroker, add new data in the agents profile and execute the scheduled event "impress_agents_idx_update", it will not do anything.
With this change meta field values are updated with the new user data added in the IDXBroker dashboard.
The only other function that is using the "impress_agents_idx_insert_post_meta" is the agent import process, I tried importing agents on a fresh install and there are no issues with this change.
Release Notes
Fix: User data sync for imported agents.
Review
Pull Requests must have the sign-off of two other developers and at least one of these must be an IDX Broker team member.