Forum: F.A.Q

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support and general questions related to GEO my WP plugin and its core add-ons please use the support forum.

[Resolved]Updating wppl_friends_locator table

Forums F.A.Q Updating wppl_friends_locator table

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #52951
    vcpros
    Member

    I’m not sure where to post this, but I am trying to update the lat & long values when a user changes their zipcode. I am using buddypress, and I have managed to update the zipcode in the wppl_friends_locator table to match the one in their profile.

    The profile zipcode has a limited number of choices, so I am trying the set the lat/long to the zipcode coordinates (whatever google maps returns) using a switch statement.

    I’ve narrowed it down that the lat/long isn’t being correctly input. The lat/long columns are float(10,6), and I’m not sure how to change those values to something else.

    Edit: added pastebin of code.

    #52976
    vcpros
    Member

    Does lat/lang column have to be float(10,6)? Can I change it to something like decimal, double, or varchar without breaking the plugin? Meaning does any functionality depending on those columns being floats?

    #52983

    Hello Vcpros,

    Is there a specific reason why you are using mysqli_query instead of using the native $wpdb for the databased queries ( see codex ) ? Also, you can retrieve the xprofile field data using BuddyPress function instead of direct SQL query.

    I believe that the script below should work for you. I didn’t test it but you might want to give it a try. Unless there is a reason that I don’t see why you’d use the direct MYSQL queries.

    And you should not modify the database structure as it will most likely create issues with the plugin ( and float is Google’s recommended column type ) . The coordinates that you are using should be saved in database.

    I hope that helps.

    #53005
    vcpros
    Member

    Hi Eyal, that worked perfectly. As to why I wasn’t using it, I simply didn’t know about it; I am familiar with myslqi_query so that’s what I went with. Thank you so much for the help, $wpdb is something to study for the future.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.