WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
Latitude and longitude not saved right (12 posts)

  1. JockeLagercrantz
    Member
    Posted 2 years ago #

    When I save en event, only the interger part of latitude and longitude are saved.
    The variable 'location_latitude' holds the correct value, but I can't figure out how it is saved and where it gets trunkated.
    As Marcus has suggested it might be an JS issue. Could anyone give me a hint?

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 2 years ago #

    you can test it by changing to default theme and deactivating other plugin (temporarily) leaving only EM active and see if its working properly.

  3. JockeLagercrantz
    Member
    Posted 2 years ago #

    I've found a solution.

    Classes -> em-location
    Line 152
    $result = $wpdb->insert($table, $data, $this->get_types($data));
    changed to
    $result = $wpdb->insert($table, $data);

    Did the same on line 145, whereafter I could save changes to locations, which was not possible before.

    location and latitude are set to float in mysql

    location_latitude float Ja NULL
    location_longitude float Ja NULL

    What issues may I run into by deleting $this->get_types($data)?

  4. agelonwl
    Member
    Posted 2 years ago #

    here's the function description of get_types Function to retreive wpdb types for all fields, or if you supply an assoc array with field names as keys it'll return an equivalent array of wpdb types

  5. agelonwl
    Member
    Posted 2 years ago #

    can I know the purpose of deleting $this->get_types($data)? it sounds like not a good idea coz' it can break EM function

  6. JockeLagercrantz
    Member
    Posted 2 years ago #

    Purpose. I want latitude and longitude to be saved completely, not truncated. By deleting $this->get_types($data) that is accomplished.
    I don't want to break any EM function so I would appreciate another solution.

  7. JockeLagercrantz
    Member
    Posted 2 years ago #

    Obviously, trunkation happens when saved to Mysql. Why is that?

  8. agelonwl
    Member
    Posted 2 years ago #

    how about changing the datatype at mysql table instead?

  9. agelonwl
    Member
    Posted 2 years ago #

    or setting a length to the float type

  10. JockeLagercrantz
    Member
    Posted 2 years ago #

    I set flot to 7,7 and put back $this->get_types($data).
    I'm back where I can't save changes to latitude and longitude. Database error.

    Changed datatype to varchar (12). Same error as above.

  11. agelonwl
    Member
    Posted 2 years ago #

    hi,

    hope this article could help you http://code.google.com/apis/maps/articles/phpsqlajax.html

  12. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    a handful of users seem to get this, however, since we're saving them as floats via wpdb (we use the %f type) and the the mysql should be a float, I have a feeling it's being caused by something else specific to your site

    if you can figure out what's causing it on your site, maybe we can correct it for others

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic