• Hi,

    I wondered if anyone had any tips on how to make this happen (I haven’t been able to start seriously looking in to this yet but thought it may be helpful to check if this had already been done/was a feature available)

    So – I’ve set the ability to add locations to users and to posts. I have BuddyPress (with Private Messages enabled) and bbPress installed.

    When a post is published with a location added to it, is it possible to have a Private Message or email notification automatically sent to any members within X miles of that location?

    And if so, any tips on how this can be achieved? (before I start searching through all the code to work this out ?? )

    Many thanks for any advice and to the author for sharing such a powerful plugin, great work!

    https://www.ads-software.com/plugins/geo-my-wp/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Eyal Fitoussi

    (@ninjew)

    HI,
    It is not possible out of the box but it is possible with custom scripts.

    1) You will need to attach your custom script to the save_post hook. The hook being executed when a post is being published/updated.

    2) The script will need to check if a location exists and if so get it from database.

    3) run a query in the members database table ( wp_friends_locator ) that will pull all members ( member ID’s ) that found within certain distance to the location of the post we pulled above. Similar query being used when searching for members using GEO my WP Members Locator forms.

    4) Send an email/Private message to the array of member ID’s we got from the query above. You can use WordPRess/BuddyPress functions that do that.

    Hope that helps.

    Thread Starter PinkishHue

    (@pinkishhue)

    Thank you Eyal @ninjew, that is really helpful. I’m trying to piece this together from the existing code but it’s a bit out of my league in coding! I will keep trying.

    Another thought I had was that perhaps the member names could just be listed within the new post, that way buddypress/bbpress would send their usual nofication automatically instead of having to add code to trigger an email.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Automatically email/PM users within X miles of location on new post?’ is closed to new replies.