Request notifications by location

Hello! In the requests extension, is the vendor notification of requests supposed utilize the geolocation of the user requests and vendor location? Or does the request notification send to all vendors on the platform? I’m trying to use it so when a user adds a request (geolocation is in the request form), then the appropriate vendors within that geolocation are notified. If this isn’t how the requests feature with geolocation is supposed to work, can you inform me where user locations are stored on the backend? Thanks

Hi,

The built-in notification option is pretty simple so it sends a notification to all vendors, if you want to allow vendors to choose specific criteria for notifications I recommend using Search Alerts extension. If you decide to implement this by yourself, the location date is stored in “hp_location”, “hp_latitude” and “hp_longitude” meta fields of request posts.

Hope this helps

I’m attempting to implement a custom feature on my platform, and I’ve run into some challenges. I’m trying to send email notifications to our vendors (users with the role of “contributor”) when a new service request is submitted within a 15-mile radius of their location.

Here’s a brief overview of what I’m attempting:

  1. Capture the Location of the New Service Request: When a new service request is posted, I retrieve its latitude and longitude from the meta fields hp_location, hp_latitude, and hp_longitude.
  2. Identify Vendors within a 15-mile Radius: Using the Haversine formula, I’m trying to query user meta data to find vendors within this radius based on their saved hp_latitude and hp_longitude.
  3. Send Notifications to Identified Vendors: For every vendor that falls within the radius, I aim to fetch their email addresses and send them notifications.

I’ve attempted to use WordPress hooks to achieve this. However, I’m unsure if I’m hooking into the correct action, or if there’s a more efficient way with HivePress’s built-in functions or hooks. I used the publish_hp_request action, but it doesn’t seem to be working as intended.

Here are my specific questions:

  1. Is there a specific HivePress action or filter that I should be using for this purpose?
  2. Are there any built-in HivePress functions or methods that could make this process more efficient or streamlined?
  3. Can you identify any potential issues with the approach I’ve described?

Your guidance would be immensely appreciated. Thank you for your time and support!

Yes, the approach seems to be ok, you can try using this action hook:

hivepress/v1/models/request/update_status

And perform any action when a request gets the “publish” status. I highly recommend using our Search Alerts extension instead, you would save time on development. If you have Search Alerts you can simply pre-define a search alert for each newly registered vendor (or they can do this by themselves). Vendors would also be able to disable notifications by deleting the alert.

This is great, thanks! I’ve tried the search alerts, but you must open the filter to find and I cannot get them to work most the time when setting. I will keep playing with it. As for the location data I am able to get the request location without issue. But, where is the vendor location data stored? Or is it stored at all?

I’m trying to utilize the search requests. I see the value as they can be enabled and disabled. I also see how the Add Search Alert appears after entering search criteria and pressing search. But, more often than not when I try to “set search alert” the button will say “delete search alert” as if set, but the “searches” does not appear in the menu. Am I executing it correctly?

If the alert is set (e.g. the Delete Search Alert link is displayed on page refresh) and the menu item doesn’t appear, please try disabling third-party plugins, this seems like a caching issue.

The vendor location is available only if enabled in HivePress/Settings/Geolocation, it’s useful if you have a separate page for searching vendor profiles.

Okay, great! Thanks! My last question is where is the vendor location data stored? Or is it stored at all? Is it a table in database? I cannot find it anywhere.

If you didn’t enable this in HivePress/Settings/Geolocation then vendors have no Location field in their profile form. Otherwise it’s stored in the same way as for listings and requests, in the “hp_location”, “hp_latitude” and “hp_longitude” meta fields of wp_postmeta table.

Hope this helps

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.