Home Forums Plugin Support WP User Frontend Pro Google maps default position on ocean atlantic

This topic is: resolved

This topic contains 9 replies, has 3 voices, and was last updated by  TomTom 5 years, 7 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #3760

    HispanicSearching
    Participant
    Post count: 15

    Hi Tareq, first thank for your great plugin.

    I'm using the google maps field but I find that default location is not working, don't care what lat and lnt in the correct format I give in the creation tool I always get the same location down “Ghana, Africa” on Ocean Atlantic.

    Any suggestion? Thanks.

    #3770

    Tareq Hasan
    Keymaster
    Post count: 2831

    The sequence is latitude and longitude, separated by a comma and no space.

    #3772

    HispanicSearching
    Participant
    Post count: 15

    This is exactly the format I use. Ej: “40.4167754,-3.7037901999999576”

    In html source I see that lng and lat isn't assigned:

    var def_longval = 0;
    var def_latval = 0;

    but the values are correctrly saved in “Default Co-ordinate”…

    #3776

    HispanicSearching
    Participant
    Post count: 15

    Well, I think I have find the problem. I use the field in a registration form and when a user access to it the post_id for the map function is the user id. When it's the first time the user access it don't have the meta assigned BUT don't use the default value. I have solved changing this:

           if ( $post_id ) {
                list( $def_lat, $def_long ) = explode( ',', $value );
            } else {
                list( $def_lat, $def_long ) = explode( ',', $attr['default_pos'] );
            }
    

    to this

           if ( $post_id ) {
                list( $def_lat, $def_long ) = explode( ',', $value );
            }
            if (!$def_lat&&!$def_long) {
                list( $def_lat, $def_long ) = explode( ',', $attr['default_pos'] );
            }
    

    the problem will append the same in a post form.

    #3777

    HispanicSearching
    Participant
    Post count: 15

    the file is “class/render-form.php”

    #3778

    Tareq Hasan
    Keymaster
    Post count: 2831

    Right, that must be the problem.

    #6458

    HispanicSearching
    Participant
    Post count: 15

    Hi Tareq, can you include this fix in your future releases ? or another one you think its better. Without it, default position don't work correctly for user profile forms.

    Thanks.

    #7121

    TomTom
    Participant
    Post count: 7

    Hi,

    how can i read the position from the browser? That's imho the solutioin…

    Best Thomas

    #7127

    Tareq Hasan
    Keymaster
    Post count: 2831

    Reading position from browser isn't possible right now from the plugin.

    #7134

    TomTom
    Participant
    Post count: 7

    Ok, i changed default to Berlin.

    That's easy – go to maps – set cursor where you want – right click what is here — you got the coordinates.
    go to render-form.php in class and change code like this around line 1471

      if ( $post_id ) {
                list( $def_lat, $def_long ) = explode( ',', $value );
            } else {
    
    // add this line
    $koordinaten = "52.536273,13.405852";  
    // Comment out this line           
     //list( $def_lat, $def_long ) = explode( ',', $attr['default_pos'] );
    // Add this line         
       list( $def_lat, $def_long ) = explode( ',', $koordinaten );
            }

    Best Thomas

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

The topic ‘Google maps default position on ocean atlantic’ is closed to new replies.