- This topic has 17 replies, 3 voices, and was last updated 3 years, 3 months ago by
Vindieselwalker.
-
AuthorPosts
-
March 5, 2015 at 1:18 am #32975
wjmediadesign
MemberIs there a way to integrate GEO my WP with the user front end for adding and editing listings? The plugin shows up automatically on the back-end listing editor, but i have not been able to figure out how to add it to the front end.
Thanks,
WilliamMarch 5, 2015 at 7:50 pm #32990Eyal Fitoussi
MemberHello William,
How exactly are you looking to integrate the two?
1) Have the entire geolocation system with the map, locator button and so on in the front end.
2) Simply make the location entered in the front-end searchable by GEO my WP.if 1 it is than I already looked into creating a complete add-on for this purpose which provide the user with the map and locator button in the front-end but I couldn’t do that because the plugin does not provide the required hooks.
If 2 is what you looking for it might be easier, again, as long as there is a hook which being execute after form submission in the front end.
I suggest you to check with the Directory plugin developer/s ( WPMUDEV ) and ask him/them if there is a hook that can be used right after the front-end form submission and if so which one it is.
If I have the right hook I might be able to help you with number 2. Number 1 will require and extensive work only if the right hooks to be provided.
March 5, 2015 at 10:39 pm #32989wjmediadesign
MemberThank you for the quick response. I reached out the the developers over at wpmudev and will get back to you with there answer shortly.
I believe your option 2 will fit my needs. I am trying to use the GMW Search Form Widget to search custom taxonomies within a zip code radius.
I am using the Listing plugin (which includes the Custom Press plugin) from WPMUDEV. Currently am using Custom Fields within Custom Press so front end users can add their address, city, zip, and state. So technically I believe I only need GEO my WP to search the custom field “zip code”.
Any thoughts?
I will get back to you shortly with the response from WPMUDEV.
Thanks,
WilliamMarch 6, 2015 at 7:43 pm #32988Eyal Fitoussi
MemberIt will be possible as long the the right hook is provided. Usually forms ( front-end and back-end ) provide a hook that being executed right after the form submission. The hook should pass the fields value of the form as arguments. Using the hook ( and a custom function ) you will be able to grab the address entered by the user, geocode it and save it in GEO my WP database table. once a location is in the custom table its post will be searchable by GEO my WP forms.
March 9, 2015 at 9:22 pm #32987wjmediadesign
MemberHi Eyal Fitoussi,
I head back from the developers at wpmu. They said:
“Directory Listing is a custom post type, so when it insert/update, you can use those WordPress native hook save_post_directory_listing or post_updated or wp_insert_post
If you have any issues please don’t hesitate to let us know so we can assist”
Here is a link to my post on their forum: http://premium.wpmudev.org/forums/topic/front-end-integration-geo-my-wp-and-directory-plugins
Thanks,
WilliamPrivate Content HiddenMarch 12, 2015 at 3:37 pm #32986wjmediadesign
MemberHi Eyal Fitoussi,
Just following up to see if you had a chance to look into this? Thanks 🙂
William
March 15, 2015 at 2:41 am #32985Eyal Fitoussi
MemberAdd the code below to the functions.php file of your theme and give it a try:
1234567891011121314151617181920212223242526272829function gmw_update_directory_listing_location( $post_id ) {if ( empty( $_POST['update_listing'] ) )return;$address_fields = array('street' => $_POST['_ct_textarea_54beb7f635c6f'],'city' => $_POST['_ct_text_54befdd39baf3'],'state' => $_POST['_ct_text_54befe359a50a'],'zipcode' => $_POST['_ct_text_54befe727214a']);//include geocoder fileinclude_once( GMW_PT_PATH .'/includes/gmw-pt-update-location.php' );if ( function_exists( 'gmw_pt_update_location' ) ) {//setup geocoder args$args = array('post_id' => $_POST['post_id'],'post_type' => 'directory_listing', // change post_type to your own'post_title' => $_POST['listing_data']['post_title'],'address' => $address_fields);//run geocoder functiongmw_pt_update_location( $args );}}add_action( 'save_post_directory_listing', 'gmw_update_directory_listing_location' );March 16, 2015 at 3:56 pm #32984wjmediadesign
MemberNothing happened when I added the above code to my functions file. I attached a screen shot to show you the front end integration still looks the same.
I even tried some searches from the home page and kept getting “No results found”
Thanks for your wonderful support and help with getting this figured out for me! 🙂
Private Content HiddenMarch 19, 2015 at 12:07 am #32983Eyal Fitoussi
MemberNothing should be added to the front-end. The script suppose to silently geocode and add the location data to GEO my WP database table on form submission. And once the location is on GEO my WP table the post should be searchable via GEO my WP form.
I am not sure why it is not working for you. If you placed it in the correct functions.php file of your theme it then should work.
Private Content HiddenMarch 19, 2015 at 1:52 am #32982wjmediadesign
MemberDo you have any other suggestions? I keen getting “No results found” after a search. I have tried the code in two separate themes and I am still getting the same results.
Would you mind taking a deeper look into my website?
Thanks,
WilliamMarch 19, 2015 at 4:29 pm #32981wjmediadesign
MemberThanks! 🙂
Private Content HiddenMarch 23, 2015 at 1:29 am #32980Eyal Fitoussi
MemberThis reply has been marked as private.March 23, 2015 at 4:02 pm #32979wjmediadesign
MemberUpdate:
Private Content HiddenMarch 23, 2015 at 8:40 pm #32978Eyal Fitoussi
MemberTesting it now it seems to be working. I just created two listings from the front-end and they successfully added to database and showing in search results.
Give it a try.
March 23, 2015 at 10:27 pm #32977wjmediadesign
MemberNew listing seem to be working but why are none of the older listing getting pulled in?
Thanks so much for your great support!
-
AuthorPosts
You must be logged in to reply to this topic.