• Resolved tkhan

    (@tkhan)


    Hi Eyal,

    I want to let buddypress members post from the frontend and automatically assign the geo details they provided in their buddypress profiles to their posts.

    I have managed to grab most of the members details from the wppl_friends_locator table except for the long value which I just cant get to work.

    The following gets the lat value

    $mylat = $wpdb->get_var(“SELECT lat FROM wppl_friends_locator WHERE member_id = ‘$user_id'”);

    but for some reason this does not work for the long value

    $mylat = $wpdb->get_var(“SELECT long FROM wppl_friends_locator WHERE member_id = ‘$user_id'”);

    any idea why this might be happening.

    Also is there anyway I can get the _wppl_lat, _wppl_long and _wppl_address meta to update via the frontend form. I have tried updating meta values (note: the values are there if I check the source but the default new york values remain in the fields on the actual page and override my hidden values if I update from the backend dropping the database entry.

    Any feedback would be greatly appreciated.

    Thanks Tkhan

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

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

    (@ninjew)

    Hi Tkhan,
    1) to get the long value try using :
    $mylat = $wpdb->get_var(“SELECT long FROM wppl_friends_locator WHERE member_id = ‘$user_id'”);
    The issue happening because long is MYSQL reserved word and that i didn’t know when i initially created the plugin. Just wrap it with grave accent like above and it should work.
    2) I am not sure i understand exactly what is happening when you are trying to update the meta values from the front end. But if you are trying to update post’s location you need to update the meta values _wppl_lat, _wppl_long, _wppl_address as well as the data in the wp_places_locator table.

    Thread Starter tkhan

    (@tkhan)

    Hi Eyal,
    The grave accents did the trick! The meta fields are also now working, I must have had a typo somewhere.

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get Long from database’ is closed to new replies.